mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-10 06:10:17 -04:00
separated user enum into its own file
This commit is contained in:
parent
8676a22ad2
commit
03f2204cb3
|
@ -18,7 +18,7 @@ from sqlalchemy import Enum
|
||||||
|
|
||||||
# Import self for to model
|
# Import self for to model
|
||||||
from typing import Self
|
from typing import Self
|
||||||
from programtype_enum import ProgramType
|
from backend.entities.program_type_enum import ProgramType
|
||||||
|
|
||||||
|
|
||||||
class ResourceEntity(EntityBase):
|
class ResourceEntity(EntityBase):
|
||||||
|
|
|
@ -17,7 +17,7 @@ import enum
|
||||||
from sqlalchemy import Enum
|
from sqlalchemy import Enum
|
||||||
|
|
||||||
# Import ProgramType enumeration
|
# Import ProgramType enumeration
|
||||||
from programtype_enum import ProgramType
|
from backend.entities.program_type_enum import ProgramType
|
||||||
|
|
||||||
|
|
||||||
class ResourceEntity(EntityBase):
|
class ResourceEntity(EntityBase):
|
||||||
|
|
|
@ -15,15 +15,8 @@ from datetime import datetime
|
||||||
# Import enums for Role and Program
|
# Import enums for Role and Program
|
||||||
import enum
|
import enum
|
||||||
from sqlalchemy import Enum
|
from sqlalchemy import Enum
|
||||||
from programtype_enumeration import ProgramType
|
from program_type_enum import ProgramType
|
||||||
|
from user_enum import RoleType
|
||||||
|
|
||||||
class RoleEnum(enum.Enum):
|
|
||||||
"""Determine role for User"""
|
|
||||||
|
|
||||||
ADMIN = "ADMIN"
|
|
||||||
EMPLOYEE = "EMPLOYEE"
|
|
||||||
VOLUNTEER = "VOLUNTEER"
|
|
||||||
|
|
||||||
|
|
||||||
class UserEntity(EntityBase):
|
class UserEntity(EntityBase):
|
||||||
|
@ -38,7 +31,7 @@ class UserEntity(EntityBase):
|
||||||
username: Mapped[str] = mapped_column(
|
username: Mapped[str] = mapped_column(
|
||||||
String(32), nullable=False, default="", unique=True
|
String(32), nullable=False, default="", unique=True
|
||||||
)
|
)
|
||||||
role: Mapped[RoleEnum] = mapped_column(Enum(RoleEnum), nullable=False)
|
role: Mapped[RoleType] = mapped_column(Enum(RoleType), nullable=False)
|
||||||
email: Mapped[str] = mapped_column(String(50), nullable=False, unique=True)
|
email: Mapped[str] = mapped_column(String(50), nullable=False, unique=True)
|
||||||
program: Mapped[list[ProgramType]] = mapped_column(
|
program: Mapped[list[ProgramType]] = mapped_column(
|
||||||
ARRAY(Enum(ProgramType)), nullable=False
|
ARRAY(Enum(ProgramType)), nullable=False
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
class RoleType(enum.Enum):
|
||||||
|
"""Determine role for User"""
|
||||||
|
|
||||||
|
ADMIN = "ADMIN"
|
||||||
|
EMPLOYEE = "EMPLOYEE"
|
||||||
|
VOLUNTEER = "VOLUNTEER"
|
Loading…
Reference in New Issue
Block a user