added logbook

This commit is contained in:
PxlLoewe
2025-05-30 19:28:07 -07:00
parent 7822369126
commit eaedd78202
17 changed files with 372 additions and 128 deletions

View File

@@ -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;

View File

@@ -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]}.`)