gabcares commited on
Commit
07a965f
·
verified ·
1 Parent(s): 111a4bd

Update utils/enrollment.py

Browse files
Files changed (1) hide show
  1. utils/enrollment.py +8 -1
utils/enrollment.py CHANGED
@@ -1,5 +1,6 @@
1
  from typing import Optional
2
  from utils.enums.grade import Grade
 
3
 
4
  from .student import Student
5
 
@@ -17,7 +18,13 @@ class Enrollment(SQLModel, table=True):
17
  grade (str): The grade assigned to the student for the course. Default if NO_GRADE with enum value of None if no grade has been assigned yet.
18
  """
19
 
20
- id: int = Field(primary_key=True)
 
 
 
 
 
 
21
  student_id: str = Field(foreign_key="student.id")
22
  course_id: str = Field(foreign_key="course.id")
23
  grade: str = Field(default=Grade.A_PLUS)
 
1
  from typing import Optional
2
  from utils.enums.grade import Grade
3
+ import uuid
4
 
5
  from .student import Student
6
 
 
18
  grade (str): The grade assigned to the student for the course. Default if NO_GRADE with enum value of None if no grade has been assigned yet.
19
  """
20
 
21
+ id: str = Field(
22
+ default_factory=lambda: str(uuid.uuid4()),
23
+ primary_key=True,
24
+ index=True,
25
+ nullable=False,
26
+ sa_column_kwargs={"unique": True}
27
+ )
28
  student_id: str = Field(foreign_key="student.id")
29
  course_id: str = Field(foreign_key="course.id")
30
  grade: str = Field(default=Grade.A_PLUS)