Add Flutter auth sessions to teams
All checks were successful
Build Docker Image / build (push) Successful in 2m10s
All checks were successful
Build Docker Image / build (push) Successful in 2m10s
This commit is contained in:
@@ -8,20 +8,20 @@ datasource db {
|
||||
}
|
||||
|
||||
model Team {
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
name String @db.VarChar(200)
|
||||
teamType String @default("BUYER") @map("team_type") @db.VarChar(20)
|
||||
logtoOrgId String? @map("logto_org_id") @db.VarChar(100)
|
||||
ownerId Int? @map("owner_id")
|
||||
owner User? @relation(fields: [ownerId], references: [id])
|
||||
selectedLocationType String? @map("selected_location_type") @db.VarChar(20)
|
||||
selectedLocationUuid String? @map("selected_location_uuid") @db.VarChar(100)
|
||||
selectedLocationName String? @map("selected_location_name") @db.VarChar(255)
|
||||
selectedLocationLat Float? @map("selected_location_lat")
|
||||
selectedLocationLon Float? @map("selected_location_lon")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
name String @db.VarChar(200)
|
||||
teamType String @default("BUYER") @map("team_type") @db.VarChar(20)
|
||||
logtoOrgId String? @map("logto_org_id") @db.VarChar(100)
|
||||
ownerId Int? @map("owner_id")
|
||||
owner User? @relation(fields: [ownerId], references: [id])
|
||||
selectedLocationType String? @map("selected_location_type") @db.VarChar(20)
|
||||
selectedLocationUuid String? @map("selected_location_uuid") @db.VarChar(100)
|
||||
selectedLocationName String? @map("selected_location_name") @db.VarChar(255)
|
||||
selectedLocationLat Float? @map("selected_location_lat")
|
||||
selectedLocationLon Float? @map("selected_location_lon")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
members TeamMember[]
|
||||
invitations TeamInvitation[]
|
||||
@@ -32,40 +32,67 @@ model Team {
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
password String @default("") @db.VarChar(128)
|
||||
username String @unique @db.VarChar(150)
|
||||
firstName String @default("") @map("first_name") @db.VarChar(150)
|
||||
lastName String @default("") @map("last_name") @db.VarChar(150)
|
||||
email String @default("") @db.VarChar(254)
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
dateJoined DateTime @default(now()) @map("date_joined")
|
||||
isSuperuser Boolean @default(false) @map("is_superuser")
|
||||
isStaff Boolean @default(false) @map("is_staff")
|
||||
lastLogin DateTime? @map("last_login")
|
||||
id Int @id @default(autoincrement())
|
||||
password String @default("") @db.VarChar(128)
|
||||
username String @unique @db.VarChar(150)
|
||||
firstName String @default("") @map("first_name") @db.VarChar(150)
|
||||
lastName String @default("") @map("last_name") @db.VarChar(150)
|
||||
email String @default("") @db.VarChar(254)
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
dateJoined DateTime @default(now()) @map("date_joined")
|
||||
isSuperuser Boolean @default(false) @map("is_superuser")
|
||||
isStaff Boolean @default(false) @map("is_staff")
|
||||
lastLogin DateTime? @map("last_login")
|
||||
|
||||
profile UserProfile?
|
||||
teams Team[]
|
||||
profile UserProfile?
|
||||
sessions AuthSession[]
|
||||
teams Team[]
|
||||
memberships TeamMember[]
|
||||
|
||||
@@map("auth_user")
|
||||
}
|
||||
|
||||
model UserProfile {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
logtoId String @unique @map("logto_id") @db.VarChar(255)
|
||||
avatarId String? @map("avatar_id") @db.VarChar(255)
|
||||
phone String @default("") @db.VarChar(50)
|
||||
activeTeamId Int? @map("active_team_id")
|
||||
activeTeam Team? @relation("ActiveTeam", fields: [activeTeamId], references: [id])
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
logtoId String @unique @map("logto_id") @db.VarChar(255)
|
||||
avatarId String? @map("avatar_id") @db.VarChar(255)
|
||||
phone String @default("") @db.VarChar(50)
|
||||
activeTeamId Int? @map("active_team_id")
|
||||
activeTeam Team? @relation("ActiveTeam", fields: [activeTeamId], references: [id])
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@map("teams_app_userprofile")
|
||||
}
|
||||
|
||||
model LoginChallenge {
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
phone String @db.VarChar(50)
|
||||
code String @db.VarChar(20)
|
||||
expiresAt DateTime @map("expires_at")
|
||||
usedAt DateTime? @map("used_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([phone])
|
||||
@@map("teams_app_loginchallenge")
|
||||
}
|
||||
|
||||
model AuthSession {
|
||||
id Int @id @default(autoincrement())
|
||||
token String @unique @db.VarChar(255)
|
||||
userId Int @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
expiresAt DateTime @map("expires_at")
|
||||
revokedAt DateTime? @map("revoked_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([userId])
|
||||
@@map("teams_app_authsession")
|
||||
}
|
||||
|
||||
model TeamMember {
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
@@ -81,16 +108,16 @@ model TeamMember {
|
||||
}
|
||||
|
||||
model TeamInvitation {
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
teamId Int @map("team_id")
|
||||
team Team @relation(fields: [teamId], references: [id])
|
||||
email String @db.VarChar(254)
|
||||
role String @default("MEMBER") @db.VarChar(20)
|
||||
status String @default("PENDING") @db.VarChar(20)
|
||||
invitedBy String @default("") @map("invited_by") @db.VarChar(255)
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
teamId Int @map("team_id")
|
||||
team Team @relation(fields: [teamId], references: [id])
|
||||
email String @db.VarChar(254)
|
||||
role String @default("MEMBER") @db.VarChar(20)
|
||||
status String @default("PENDING") @db.VarChar(20)
|
||||
invitedBy String @default("") @map("invited_by") @db.VarChar(255)
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
tokens TeamInvitationToken[]
|
||||
|
||||
@@ -99,14 +126,14 @@ model TeamInvitation {
|
||||
}
|
||||
|
||||
model TeamInvitationToken {
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
invitationId Int @map("invitation_id")
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
invitationId Int @map("invitation_id")
|
||||
invitation TeamInvitation @relation(fields: [invitationId], references: [id])
|
||||
tokenHash String @unique @map("token_hash") @db.VarChar(255)
|
||||
workflowStatus String @default("pending") @map("workflow_status") @db.VarChar(20)
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
tokenHash String @unique @map("token_hash") @db.VarChar(255)
|
||||
workflowStatus String @default("pending") @map("workflow_status") @db.VarChar(20)
|
||||
expiresAt DateTime? @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@map("teams_app_teaminvitationtoken")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user