forked from dylanmcreynolds/splash-userservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
31 lines (22 loc) · 1.29 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from typing import List, Optional
from pydantic import BaseModel, Field
class UniqueId(BaseModel):
id: str = Field("globally unique identifier for user")
source: Optional[str] = Field("indicates source of identifier, e.g. ORCID")
class User(BaseModel):
uid: str = Field(description="system unique identifier")
authenticators: Optional[List[UniqueId]] = Field(None, description="list of accounts that user can be known by")
given_name: Optional[str] = Field(None, description="user's given name", schema="https://schema.org/givenName")
family_name: Optional[str] = Field(None, description="user's family name")
current_institution: Optional[str] = Field(None, description="user's currently known institution")
current_email: Optional[str] = Field(None, description="user's currently known email")
groups: Optional[List[str]] = Field(None, description="list of groups a user belongs to")
orcid: str = Field(description="user's ORCID")
class AccessGroup(BaseModel):
uid: str = Field(description="group's system unique identifier")
name: str = Field(description="group's name")
members: Optional[List[UniqueId]] = Field(None, description="list of users in the access group")
class MappedField(BaseModel):
source: str
source_name: str
source_dtype: str