added logbook
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
"generate": "npx prisma generate && npx prisma generate zod",
|
||||
"migrate": "npx prisma migrate dev",
|
||||
"deploy": "npx prisma migrate deploy",
|
||||
"dev": "npx prisma studio"
|
||||
"dev": "npx prisma studio --browser none"
|
||||
},
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
|
||||
@@ -37,4 +37,29 @@ export interface MissionMessageLog {
|
||||
};
|
||||
}
|
||||
|
||||
export type MissionLog = MissionStationLog | MissionMessageLog | MissionSdsLog;
|
||||
export interface MissionAlertLog {
|
||||
type: "alert-log";
|
||||
auto: false;
|
||||
timeStamp: string;
|
||||
data: {
|
||||
station?: Station;
|
||||
vehicle?: string;
|
||||
user: PublicUser;
|
||||
};
|
||||
}
|
||||
|
||||
export interface MissionCompletedLog {
|
||||
type: "completed-log";
|
||||
auto: boolean;
|
||||
timeStamp: string;
|
||||
data: {
|
||||
user?: PublicUser;
|
||||
};
|
||||
}
|
||||
|
||||
export type MissionLog =
|
||||
| MissionStationLog
|
||||
| MissionMessageLog
|
||||
| MissionSdsLog
|
||||
| MissionAlertLog
|
||||
| MissionCompletedLog;
|
||||
|
||||
@@ -8,13 +8,21 @@ export interface PublicUser {
|
||||
fullName: string;
|
||||
}
|
||||
|
||||
export const getPublicUser = (user: User): PublicUser => {
|
||||
export const getPublicUser = (
|
||||
user: User,
|
||||
options = {
|
||||
ignorePrivacy: false,
|
||||
},
|
||||
): PublicUser => {
|
||||
return {
|
||||
firstname: user.firstname,
|
||||
lastname: user.lastname
|
||||
.split(" ")
|
||||
.map((part) => `${part[0]}.`)
|
||||
.join(" "), // Only take the first part of the name
|
||||
lastname:
|
||||
user.settingsHideLastname && !options.ignorePrivacy
|
||||
? ""
|
||||
: user.lastname
|
||||
.split(" ")
|
||||
.map((part) => `${part[0]}.`)
|
||||
.join(" "), // Only take the first part of the name
|
||||
fullName: `${user.firstname} ${user.lastname
|
||||
.split(" ")
|
||||
.map((part) => `${part[0]}.`)
|
||||
|
||||
@@ -30,14 +30,15 @@ model User {
|
||||
moodleId Int? @map(name: "moodle_id")
|
||||
|
||||
// Settings:
|
||||
settingsNtfyRoom String? @map(name: "settings_ntfy_room")
|
||||
settingsMicDevice String? @map(name: "settings_mic_device")
|
||||
settingsMicVolume Int? @map(name: "settings_mic_volume")
|
||||
settingsNtfyRoom String? @map(name: "settings_ntfy_room")
|
||||
settingsMicDevice String? @map(name: "settings_mic_device")
|
||||
settingsMicVolume Int? @map(name: "settings_mic_volume")
|
||||
settingsHideLastname Boolean @default(false) @map(name: "settings_hide_lastname")
|
||||
|
||||
// email Verification:
|
||||
emailVerificationToken String? @map(name: "email_verification_token")
|
||||
emailVerificationExpiresAt DateTime? @map(name: "email_verification_expires_at")
|
||||
emailVerified Boolean? @default(false)
|
||||
emailVerified Boolean @default(false)
|
||||
|
||||
image String?
|
||||
badges BADGES[] @default([])
|
||||
|
||||
Reference in New Issue
Block a user