Skip to content

module/waitlist.py

module.waitlist

WaitList

WaitList

WaitList object

Source code in module/waitlist.py
class WaitList:
    ''' WaitList object '''
    @staticmethod
    def join_to(pid: str, tid: str, uid: str, note: str) -> dict[str, Any]:
        ''' Join to

        Args:
            pid (str): Project id.
            tid (str): Team id.
            uid (str): User id.
            note (str): Note.

        Returns:
            Return the datas.

        '''
        return WaitListDB().join_to(pid=pid, tid=tid, uid=uid, note=note)

    @staticmethod
    def is_in_wait(pid: str, tid: str, uid: str) -> int:
        ''' is in wait list

        Args:
            pid (str): Project id.
            tid (str): Team id.
            uid (str): User id.

        Returns:
            Return the numbers.

        '''
        return WaitListDB().is_in_wait(pid=pid, tid=tid, uid=uid)

    @staticmethod
    def list_by_team(pid: str, tid: str, uid: Optional[str] = None) -> \
            Generator[dict[str, Any], None, None] | None:
        ''' List team waiting user

        Args:
            pid (str): Project id.
            tid (str): Team id.
            uid (str): User id.

        Returns:
            Return the datas.

        '''
        return WaitListDB().list_by(pid=pid, tid=tid, uid=uid)

    @staticmethod
    def make_result(wid: str, pid: str, uid: str,
                    result: Literal['approval', 'deny']) -> Optional[dict[str, Any]]:
        ''' make result

        Args:
            wid (str): Waitlist id.
            pid (str): Project id.
            uid (str): User id.
            result (str): List in `approval`, `deny`.

        Returns:
            Return the data.

        '''
        return WaitListDB().make_result(_id=wid, pid=pid, uid=uid, result=result)

    @staticmethod
    def find_history(uid: str, pid: Optional[str] = None) -> Cursor[dict[str, Any]]:
        ''' Find some one history

        Args:
            pid (str): Project id.
            uid (str): User id.

        Returns:
            Return the [pymongo.cursor.Cursor][] object.

        '''
        query = {'uid': uid}
        if pid is not None:
            query['pid'] = pid

        return WaitListDB().find(query)

    @staticmethod
    def find_history_in_team(uid: str, pid: str, tid: str) -> Generator[dict[str, Any], None, None]:
        ''' Find some one history in team

        Args:
            uid (str): User id.
            pid (str): Project id.
            tid (str): Team id.

        Yields:
            Return the datas.

        '''
        for raw in WaitListDB().find({'pid': pid, 'tid': tid, 'uid': uid}):
            yield raw

    @staticmethod
    def get_note(pid: str, tid: str, uid: str) -> Generator[dict[str, str], None, None]:
        ''' Get note

        Args:
            pid (str): Project id.
            tid (str): Team id.
            uid (str): User id.

        Yields:
            Return the datas.

        '''
        for raw in WaitListDB().find(
            filter={'pid': pid, 'tid': tid, 'uid': uid},
            projection={'_id': 0},
            sort=(('_id', -1), ),
            limit=1,
        ):
            yield raw

find_history staticmethod

find_history(
    uid: str, pid: Optional[str] = None
) -> Cursor[dict[str, Any]]

Find some one history

Parameters:

Name Type Description Default
pid str

Project id.

None
uid str

User id.

required

Returns:

Type Description
Cursor[dict[str, Any]]

Return the pymongo.cursor.Cursor object.

Source code in module/waitlist.py
@staticmethod
def find_history(uid: str, pid: Optional[str] = None) -> Cursor[dict[str, Any]]:
    ''' Find some one history

    Args:
        pid (str): Project id.
        uid (str): User id.

    Returns:
        Return the [pymongo.cursor.Cursor][] object.

    '''
    query = {'uid': uid}
    if pid is not None:
        query['pid'] = pid

    return WaitListDB().find(query)

find_history_in_team staticmethod

find_history_in_team(
    uid: str, pid: str, tid: str
) -> Generator[dict[str, Any], None, None]

Find some one history in team

Parameters:

Name Type Description Default
uid str

User id.

required
pid str

Project id.

required
tid str

Team id.

required

Yields:

Type Description
dict[str, Any]

Return the datas.

Source code in module/waitlist.py
@staticmethod
def find_history_in_team(uid: str, pid: str, tid: str) -> Generator[dict[str, Any], None, None]:
    ''' Find some one history in team

    Args:
        uid (str): User id.
        pid (str): Project id.
        tid (str): Team id.

    Yields:
        Return the datas.

    '''
    for raw in WaitListDB().find({'pid': pid, 'tid': tid, 'uid': uid}):
        yield raw

get_note staticmethod

get_note(
    pid: str, tid: str, uid: str
) -> Generator[dict[str, str], None, None]

Get note

Parameters:

Name Type Description Default
pid str

Project id.

required
tid str

Team id.

required
uid str

User id.

required

Yields:

Type Description
dict[str, str]

Return the datas.

Source code in module/waitlist.py
@staticmethod
def get_note(pid: str, tid: str, uid: str) -> Generator[dict[str, str], None, None]:
    ''' Get note

    Args:
        pid (str): Project id.
        tid (str): Team id.
        uid (str): User id.

    Yields:
        Return the datas.

    '''
    for raw in WaitListDB().find(
        filter={'pid': pid, 'tid': tid, 'uid': uid},
        projection={'_id': 0},
        sort=(('_id', -1), ),
        limit=1,
    ):
        yield raw

is_in_wait staticmethod

is_in_wait(pid: str, tid: str, uid: str) -> int

is in wait list

Parameters:

Name Type Description Default
pid str

Project id.

required
tid str

Team id.

required
uid str

User id.

required

Returns:

Type Description
int

Return the numbers.

Source code in module/waitlist.py
@staticmethod
def is_in_wait(pid: str, tid: str, uid: str) -> int:
    ''' is in wait list

    Args:
        pid (str): Project id.
        tid (str): Team id.
        uid (str): User id.

    Returns:
        Return the numbers.

    '''
    return WaitListDB().is_in_wait(pid=pid, tid=tid, uid=uid)

join_to staticmethod

join_to(
    pid: str, tid: str, uid: str, note: str
) -> dict[str, Any]

Join to

Parameters:

Name Type Description Default
pid str

Project id.

required
tid str

Team id.

required
uid str

User id.

required
note str

Note.

required

Returns:

Type Description
dict[str, Any]

Return the datas.

Source code in module/waitlist.py
@staticmethod
def join_to(pid: str, tid: str, uid: str, note: str) -> dict[str, Any]:
    ''' Join to

    Args:
        pid (str): Project id.
        tid (str): Team id.
        uid (str): User id.
        note (str): Note.

    Returns:
        Return the datas.

    '''
    return WaitListDB().join_to(pid=pid, tid=tid, uid=uid, note=note)

list_by_team staticmethod

list_by_team(
    pid: str, tid: str, uid: Optional[str] = None
) -> Generator[dict[str, Any], None, None] | None

List team waiting user

Parameters:

Name Type Description Default
pid str

Project id.

required
tid str

Team id.

required
uid str

User id.

None

Returns:

Type Description
Generator[dict[str, Any], None, None] | None

Return the datas.

Source code in module/waitlist.py
@staticmethod
def list_by_team(pid: str, tid: str, uid: Optional[str] = None) -> \
        Generator[dict[str, Any], None, None] | None:
    ''' List team waiting user

    Args:
        pid (str): Project id.
        tid (str): Team id.
        uid (str): User id.

    Returns:
        Return the datas.

    '''
    return WaitListDB().list_by(pid=pid, tid=tid, uid=uid)

make_result staticmethod

make_result(
    wid: str,
    pid: str,
    uid: str,
    result: Literal["approval", "deny"],
) -> Optional[dict[str, Any]]

make result

Parameters:

Name Type Description Default
wid str

Waitlist id.

required
pid str

Project id.

required
uid str

User id.

required
result str

List in approval, deny.

required

Returns:

Type Description
Optional[dict[str, Any]]

Return the data.

Source code in module/waitlist.py
@staticmethod
def make_result(wid: str, pid: str, uid: str,
                result: Literal['approval', 'deny']) -> Optional[dict[str, Any]]:
    ''' make result

    Args:
        wid (str): Waitlist id.
        pid (str): Project id.
        uid (str): User id.
        result (str): List in `approval`, `deny`.

    Returns:
        Return the data.

    '''
    return WaitListDB().make_result(_id=wid, pid=pid, uid=uid, result=result)