57 lines
911 B
Python
57 lines
911 B
Python
from datetime import datetime
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class CertificateBase(BaseModel):
|
|
expiry: datetime
|
|
|
|
|
|
class CertificateCreate(CertificateBase):
|
|
owner_name: str
|
|
dn_id: int
|
|
|
|
|
|
class Certificate(CertificateBase):
|
|
id: int
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
name: str
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
password: str
|
|
|
|
|
|
class User(UserBase):
|
|
capabilities: list[str]
|
|
certificates: list[Certificate]
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class DistinguishedNameBase(BaseModel):
|
|
cn_only: bool
|
|
country: str
|
|
state: str
|
|
city: str
|
|
organization: str
|
|
organizational_unit: str
|
|
email: str
|
|
common_name: str
|
|
|
|
|
|
class DistinguishedNameCreate(DistinguishedNameBase):
|
|
pass
|
|
|
|
|
|
class DistinguishedName(DistinguishedNameBase):
|
|
id: int
|
|
certificates: list[Certificate]
|
|
|
|
class Config:
|
|
orm_mode = True
|