Skip to content

models/applyreviewdb.py

models.applyreviewdb

Apply Review DB

ApplyReviewDB

Bases: DBBase

Apply Review Collection

Source code in models/applyreviewdb.py
class ApplyReviewDB(DBBase):
    ''' Apply Review Collection'''

    def __init__(self) -> None:
        super().__init__('applyreview')

    def index(self) -> None:
        ''' To make collection's index

        Indexs:
            - `pid`, `tid`

        '''
        self.create_index([('pid', 1), ('tid', 1)])

    def save(self, data: TeamApplyReview) -> None:
        ''' Save data

        Args:
            data (TeamApplyReview): the struct of [structs.teams.TeamApplyReview][].

        '''

        self.find_one_and_update(
            {'pid': data.pid, 'tid': data.tid, 'uid': data.uid},
            {'$set': data.dict()},
            upsert=True,
        )

index

index() -> None

To make collection's index

Indexs
  • pid, tid
Source code in models/applyreviewdb.py
def index(self) -> None:
    ''' To make collection's index

    Indexs:
        - `pid`, `tid`

    '''
    self.create_index([('pid', 1), ('tid', 1)])

save

save(data: TeamApplyReview) -> None

Save data

Parameters:

Name Type Description Default
data TeamApplyReview required
Source code in models/applyreviewdb.py
def save(self, data: TeamApplyReview) -> None:
    ''' Save data

    Args:
        data (TeamApplyReview): the struct of [structs.teams.TeamApplyReview][].

    '''

    self.find_one_and_update(
        {'pid': data.pid, 'tid': data.tid, 'uid': data.uid},
        {'$set': data.dict()},
        upsert=True,
    )

Last update: May 1, 2023