2022-10-08 00:00:45 -05:00
|
|
|
export interface Identifiable {
|
2022-10-07 23:22:35 -05:00
|
|
|
id: string;
|
2022-10-08 00:00:45 -05:00
|
|
|
}
|
|
|
|
|
2022-10-08 02:01:48 -05:00
|
|
|
export interface Created {
|
2022-10-07 23:22:35 -05:00
|
|
|
createdAt: Date;
|
2022-10-08 00:00:45 -05:00
|
|
|
}
|
|
|
|
|
2022-10-08 02:01:48 -05:00
|
|
|
export interface Updated {
|
2022-10-08 00:00:45 -05:00
|
|
|
updatedAt: Date;
|
|
|
|
}
|
|
|
|
|
2022-10-08 02:01:48 -05:00
|
|
|
export type Timestamped = Created & Updated;
|
2022-10-08 00:00:45 -05:00
|
|
|
|
2022-10-08 00:24:03 -05:00
|
|
|
export interface Team extends Identifiable, Timestamped {
|
|
|
|
displayName: string;
|
|
|
|
}
|
|
|
|
|
2022-10-08 00:00:45 -05:00
|
|
|
export interface User extends Identifiable, Timestamped {
|
|
|
|
username: string;
|
|
|
|
passwordDigest: string;
|
|
|
|
displayName?: string;
|
|
|
|
}
|
2022-10-08 02:01:48 -05:00
|
|
|
|
2022-10-11 16:17:21 -05:00
|
|
|
export type PublicUser = Pick<
|
|
|
|
User,
|
|
|
|
| "displayName"
|
|
|
|
| "username"
|
|
|
|
| keyof Identifiable
|
|
|
|
>;
|
|
|
|
|
2022-10-08 02:53:13 -05:00
|
|
|
export interface Note extends Identifiable, Timestamped {
|
|
|
|
content: string;
|
|
|
|
userId: User["id"] | null;
|
|
|
|
userUsername?: User["username"];
|
|
|
|
userDisplayName?: User["displayName"];
|
|
|
|
}
|
|
|
|
|
2022-10-08 02:01:48 -05:00
|
|
|
type IdentifierFor<T extends Identifiable> = T["id"];
|
|
|
|
|
|
|
|
export interface Token extends Created {
|
|
|
|
bytes?: Uint8Array;
|
|
|
|
digest: Uint8Array;
|
|
|
|
userId: IdentifierFor<User>;
|
|
|
|
data: Record<string, unknown> | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 32 bytes base64-encoded */
|
|
|
|
export type TokenDigest = string;
|
2022-10-08 02:53:13 -05:00
|
|
|
|
2022-10-21 03:06:37 -05:00
|
|
|
export interface ContextState extends Record<string, unknown> {
|
2022-10-11 16:17:21 -05:00
|
|
|
user?: PublicUser;
|
2022-10-12 03:31:26 -05:00
|
|
|
something?: string;
|
2022-10-08 02:53:13 -05:00
|
|
|
}
|
2022-10-21 03:06:37 -05:00
|
|
|
|
2022-11-10 16:39:48 -06:00
|
|
|
export type TeamUserStatus =
|
|
|
|
| "invited"
|
|
|
|
| "accepted"
|
|
|
|
| "manager"
|
|
|
|
| "owner"
|
|
|
|
| "removed"
|
|
|
|
| "left";
|
2022-10-21 03:06:37 -05:00
|
|
|
export interface TeamUser {
|
|
|
|
userId: IdentifierFor<User>;
|
|
|
|
teamId: IdentifierFor<Team>;
|
|
|
|
status: TeamUserStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Playlist extends Identifiable, Timestamped {
|
|
|
|
displayName: string;
|
|
|
|
teamId: IdentifierFor<Team>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Display extends Identifiable, Timestamped {
|
|
|
|
displayName: string;
|
|
|
|
teamId: IdentifierFor<Team>;
|
|
|
|
playlistId: IdentifierFor<Playlist>;
|
|
|
|
isFrozen: boolean;
|
|
|
|
isBlanked: boolean;
|
|
|
|
currentSongIndex: number;
|
|
|
|
currentVerseIndex: number;
|
|
|
|
}
|
|
|
|
export type Ungenerated<T> = Omit<T, keyof Identifiable | keyof Timestamped>;
|