merge main into liked songs
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { Note } from 'opensheetmusicdisplay';
|
||||
|
||||
export type PianoCursorNote = {
|
||||
note: Note;
|
||||
duration: number;
|
||||
};
|
||||
|
||||
export type PianoCursorPosition = {
|
||||
// offset in pixels
|
||||
x: number;
|
||||
// timestamp in ms
|
||||
timing: number;
|
||||
timestamp: number;
|
||||
notes: PianoCursorNote[];
|
||||
};
|
||||
|
||||
export type UpdateInfo = {
|
||||
currentTimestamp: number;
|
||||
status: 'playing' | 'paused' | 'stopped';
|
||||
};
|
||||
|
||||
export type PianoScoreInfo = {
|
||||
score: number;
|
||||
streak: number;
|
||||
};
|
||||
|
||||
export enum NoteTiming {
|
||||
Perfect = 'Perfect',
|
||||
Great = 'Great',
|
||||
Good = 'Good',
|
||||
Missed = 'Missed',
|
||||
Wrong = 'Wrong',
|
||||
}
|
||||
|
||||
export type PianoCanvasMsg = {
|
||||
type: 'noteTiming' | 'scoreInfo' | 'gameUpdate';
|
||||
data: UpdateInfo | NoteTiming | PianoScoreInfo | number;
|
||||
};
|
||||
|
||||
export type PianoCanvasContext = {
|
||||
messages: Array<PianoCanvasMsg>;
|
||||
// Timestamp of the play session, in miliseconds
|
||||
timestamp: number;
|
||||
pressedKeys: Map<number, number>;
|
||||
};
|
||||
+11
-3
@@ -6,9 +6,15 @@ import API from '../API';
|
||||
export const UserValidator = yup
|
||||
.object({
|
||||
username: yup.string().required(),
|
||||
password: yup.string().required().nullable(),
|
||||
email: yup.string().required(),
|
||||
password: yup
|
||||
.string()
|
||||
.nullable()
|
||||
.transform((value) => (value === '' ? null : value)),
|
||||
emailVerified: yup.boolean().required(),
|
||||
email: yup
|
||||
.string()
|
||||
.nullable()
|
||||
.transform((value) => (value === '' ? null : value)),
|
||||
googleID: yup.string().required().nullable(),
|
||||
isGuest: yup.boolean().required(),
|
||||
partyPlayed: yup.number().required(),
|
||||
@@ -19,6 +25,7 @@ export const UserHandler: ResponseHandler<yup.InferType<typeof UserValidator>, U
|
||||
validator: UserValidator,
|
||||
transformer: (value) => ({
|
||||
...value,
|
||||
email: value.email ?? null,
|
||||
name: value.username,
|
||||
premium: false,
|
||||
data: {
|
||||
@@ -32,8 +39,9 @@ export const UserHandler: ResponseHandler<yup.InferType<typeof UserValidator>, U
|
||||
|
||||
interface User extends Model {
|
||||
name: string;
|
||||
email: string;
|
||||
emailVerified: boolean;
|
||||
// guest accounts don't have a mail
|
||||
email: string | null;
|
||||
googleID: string | null;
|
||||
isGuest: boolean;
|
||||
premium: boolean;
|
||||
|
||||
Reference in New Issue
Block a user