rasenmaeher_api.db.enrollments
Abstractions for enrollments
Module Contents
Classes
Enrollment pools aka links, pk is UUID and comes from basemodel |
|
Enrollment states |
|
Enrollments, pk is UUID and comes from basemodel |
Attributes
- class EnrollmentPool[source]
Bases:
rasenmaeher_api.db.base.ORMBaseModel
Enrollment pools aka links, pk is UUID and comes from basemodel
- async classmethod by_pk_or_invitecode(inval, allow_deleted=False)[source]
Get pool by pk or by invitecode
- Parameters:
- Return type:
- async create_enrollment(callsign)[source]
Create enrollment from this pool
- Parameters:
callsign (str)
- Return type:
- async set_active(state)[source]
Set active and return refreshed object
- Parameters:
state (bool)
- Return type:
Self
- async classmethod list(by_owner=None, include_deleted=False)[source]
List pools, optionally by owner or including deleted pools
- Parameters:
by_owner (Optional[rasenmaeher_api.db.people.Person])
include_deleted (bool)
- Return type:
AsyncGenerator[EnrollmentPool, None]
- async classmethod _generate_unused_code()[source]
Internal helper to generate a code that is free NOTE: This MUST ONLY be used inside a transaction for nothing is guaranteed
- Return type:
- async classmethod create_for_owner(person, extra=None)[source]
Creates one for given owner
- Parameters:
person (rasenmaeher_api.db.people.Person)
extra (Optional[Dict[str, Any]])
- Return type:
Self
- class EnrollmentState[source]
Bases:
enum.IntEnum
Enrollment states
- class Enrollment[source]
Bases:
rasenmaeher_api.db.base.ORMBaseModel
Enrollments, pk is UUID and comes from basemodel
- async classmethod by_pk_or_callsign(inval)[source]
Get enrollment by pk or by callsign
- Parameters:
- Return type:
- async approve(approver)[source]
Creates the person record, their certs etc
- Parameters:
approver (rasenmaeher_api.db.people.Person)
- Return type:
- async reject(decider)[source]
Reject
- Parameters:
decider (rasenmaeher_api.db.people.Person)
- Return type:
None
- async classmethod list(by_pool=None)[source]
List enrollments, optionally by pool (enrollment deletion is not allowed, they can only be rejected)
- Parameters:
by_pool (Optional[EnrollmentPool])
- Return type:
AsyncGenerator[Enrollment, None]
- async classmethod by_callsign(callsign)[source]
Get by callsign
- Parameters:
callsign (str)
- Return type:
Self
- async classmethod by_approvecode(code)[source]
Get by approvecode
- Parameters:
code (str)
- Return type:
Self
- async classmethod _generate_unused_code()[source]
Internal helper to generate a code that is free NOTE: This MUST ONLY be used inside a transaction for nothing is guaranteed
- Return type:
- async classmethod create_for_callsign(callsign, pool=None, extra=None)[source]
Create a new one with random code for the callsign
- Parameters:
callsign (str)
pool (Optional[EnrollmentPool])
extra (Optional[Dict[str, Any]])
- Return type:
Self