Skip to content

Model review and restructuring some models #21

@emrdagkusu

Description

@emrdagkusu

We should review our models on MongoDB to be able to make them proper for future developments. Also, we should add some models such as slots, absences.

class AbsenceModel(BaseModel):
    id: PyObjectId = Field(default_factory=PyObjectId, alias="_id")
    absence: str = Field(...)

    class Config:
        allow_population_by_field_name = True
        arbitrary_types_allowed = True
        json_encoders = {ObjectId: str}
        schema_extra = {
            "example": {
                "absence": "1,0,2",
            }
        }

For example in here instead of putting absences as comma-separated strings, we can have attributes and while decoding and encoding we can change them as we want and use them properly. And with this way, we can be able to control those attributes in the model instead of endpoints.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions