|
@@ -32,35 +32,41 @@ export class User extends Model<
|
|
> {
|
|
> {
|
|
declare _id: CreationOptional<ObjectIdType>;
|
|
declare _id: CreationOptional<ObjectIdType>;
|
|
|
|
|
|
- declare name: string;
|
|
|
|
-
|
|
|
|
declare username: string;
|
|
declare username: string;
|
|
|
|
|
|
declare role: UserRole;
|
|
declare role: UserRole;
|
|
|
|
|
|
- declare emailAddress: string;
|
|
|
|
-
|
|
|
|
- declare emailVerifiedAt: CreationOptional<Date | null>;
|
|
|
|
|
|
+ declare emailVerified: CreationOptional<boolean>;
|
|
|
|
|
|
declare emailVerificationToken: CreationOptional<string | null>;
|
|
declare emailVerificationToken: CreationOptional<string | null>;
|
|
|
|
|
|
- declare avatarType: UserAvatarType;
|
|
|
|
|
|
+ declare emailAddress: string;
|
|
|
|
|
|
- declare avatarColor: CreationOptional<UserAvatarColor | null>;
|
|
|
|
|
|
+ declare avatarType: UserAvatarType;
|
|
|
|
|
|
declare avatarUrl: CreationOptional<string | null>;
|
|
declare avatarUrl: CreationOptional<string | null>;
|
|
|
|
|
|
|
|
+ declare avatarColor: CreationOptional<UserAvatarColor | null>;
|
|
|
|
+
|
|
|
|
+ // Services
|
|
declare password: string;
|
|
declare password: string;
|
|
|
|
|
|
- declare passwordResetToken: CreationOptional<string | null>;
|
|
|
|
|
|
+ declare passwordResetCode: CreationOptional<string | null>;
|
|
|
|
|
|
declare passwordResetExpiresAt: CreationOptional<Date | null>;
|
|
declare passwordResetExpiresAt: CreationOptional<Date | null>;
|
|
|
|
|
|
|
|
+ declare passwordSetCode: CreationOptional<string | null>;
|
|
|
|
+
|
|
|
|
+ declare passwordSetExpiresAt: CreationOptional<Date | null>;
|
|
|
|
+
|
|
declare githubId: CreationOptional<number | null>;
|
|
declare githubId: CreationOptional<number | null>;
|
|
|
|
|
|
declare githubAccessToken: CreationOptional<string | null>;
|
|
declare githubAccessToken: CreationOptional<string | null>;
|
|
|
|
+ // End services
|
|
|
|
|
|
|
|
+ // Statistics
|
|
declare songsRequested: CreationOptional<number>;
|
|
declare songsRequested: CreationOptional<number>;
|
|
|
|
+ // End statistics
|
|
|
|
|
|
// declare likedSongsPlaylist: Types.ObjectId;
|
|
// declare likedSongsPlaylist: Types.ObjectId;
|
|
|
|
|
|
@@ -68,10 +74,13 @@ export class User extends Model<
|
|
|
|
|
|
// declare favoriteStations: Types.ObjectId[];
|
|
// declare favoriteStations: Types.ObjectId[];
|
|
|
|
|
|
|
|
+ declare name: string;
|
|
|
|
+
|
|
declare location: CreationOptional<string | null>;
|
|
declare location: CreationOptional<string | null>;
|
|
|
|
|
|
declare bio: CreationOptional<string | null>;
|
|
declare bio: CreationOptional<string | null>;
|
|
|
|
|
|
|
|
+ // Preferences
|
|
// declare orderOfPlaylists: Types.ObjectId[];
|
|
// declare orderOfPlaylists: Types.ObjectId[];
|
|
|
|
|
|
declare nightmode: CreationOptional<boolean>;
|
|
declare nightmode: CreationOptional<boolean>;
|
|
@@ -83,6 +92,7 @@ export class User extends Model<
|
|
declare anonymousSongRequests: CreationOptional<boolean>;
|
|
declare anonymousSongRequests: CreationOptional<boolean>;
|
|
|
|
|
|
declare activityWatch: CreationOptional<boolean>;
|
|
declare activityWatch: CreationOptional<boolean>;
|
|
|
|
+ // End preferences
|
|
|
|
|
|
declare createdAt: CreationOptional<Date>;
|
|
declare createdAt: CreationOptional<Date>;
|
|
|
|
|
|
@@ -152,16 +162,13 @@ export class User extends Model<
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// TODO add validation
|
|
export const schema = {
|
|
export const schema = {
|
|
_id: {
|
|
_id: {
|
|
type: DataTypes.OBJECTID,
|
|
type: DataTypes.OBJECTID,
|
|
autoNull: false,
|
|
autoNull: false,
|
|
primaryKey: true
|
|
primaryKey: true
|
|
},
|
|
},
|
|
- name: {
|
|
|
|
- type: DataTypes.STRING,
|
|
|
|
- allowNull: false
|
|
|
|
- },
|
|
|
|
username: {
|
|
username: {
|
|
type: DataTypes.STRING,
|
|
type: DataTypes.STRING,
|
|
allowNull: false
|
|
allowNull: false
|
|
@@ -170,35 +177,36 @@ export const schema = {
|
|
type: DataTypes.ENUM(...Object.values(UserRole)),
|
|
type: DataTypes.ENUM(...Object.values(UserRole)),
|
|
allowNull: false
|
|
allowNull: false
|
|
},
|
|
},
|
|
- emailAddress: {
|
|
|
|
- type: DataTypes.STRING,
|
|
|
|
- allowNull: false
|
|
|
|
- },
|
|
|
|
- emailVerifiedAt: {
|
|
|
|
- type: DataTypes.DATE,
|
|
|
|
- allowNull: true
|
|
|
|
|
|
+ emailVerified: {
|
|
|
|
+ type: DataTypes.BOOLEAN,
|
|
|
|
+ allowNull: true,
|
|
|
|
+ defaultValue: false
|
|
},
|
|
},
|
|
emailVerificationToken: {
|
|
emailVerificationToken: {
|
|
type: DataTypes.STRING,
|
|
type: DataTypes.STRING,
|
|
allowNull: true
|
|
allowNull: true
|
|
},
|
|
},
|
|
|
|
+ emailAddress: {
|
|
|
|
+ type: DataTypes.STRING,
|
|
|
|
+ allowNull: false
|
|
|
|
+ },
|
|
avatarType: {
|
|
avatarType: {
|
|
type: DataTypes.ENUM(...Object.values(UserAvatarType)),
|
|
type: DataTypes.ENUM(...Object.values(UserAvatarType)),
|
|
allowNull: false
|
|
allowNull: false
|
|
},
|
|
},
|
|
- avatarColor: {
|
|
|
|
- type: DataTypes.ENUM(...Object.values(UserAvatarColor)),
|
|
|
|
- allowNull: true
|
|
|
|
- },
|
|
|
|
avatarUrl: {
|
|
avatarUrl: {
|
|
type: DataTypes.STRING,
|
|
type: DataTypes.STRING,
|
|
allowNull: true
|
|
allowNull: true
|
|
},
|
|
},
|
|
|
|
+ avatarColor: {
|
|
|
|
+ type: DataTypes.ENUM(...Object.values(UserAvatarColor)),
|
|
|
|
+ allowNull: true
|
|
|
|
+ },
|
|
password: {
|
|
password: {
|
|
type: DataTypes.STRING,
|
|
type: DataTypes.STRING,
|
|
allowNull: false
|
|
allowNull: false
|
|
},
|
|
},
|
|
- passwordResetToken: {
|
|
|
|
|
|
+ passwordResetCode: {
|
|
type: DataTypes.STRING,
|
|
type: DataTypes.STRING,
|
|
allowNull: true
|
|
allowNull: true
|
|
},
|
|
},
|
|
@@ -206,6 +214,14 @@ export const schema = {
|
|
type: DataTypes.DATE,
|
|
type: DataTypes.DATE,
|
|
allowNull: true
|
|
allowNull: true
|
|
},
|
|
},
|
|
|
|
+ passwordSetCode: {
|
|
|
|
+ type: DataTypes.STRING,
|
|
|
|
+ allowNull: true
|
|
|
|
+ },
|
|
|
|
+ passwordSetExpiresAt: {
|
|
|
|
+ type: DataTypes.DATE,
|
|
|
|
+ allowNull: true
|
|
|
|
+ },
|
|
githubId: {
|
|
githubId: {
|
|
type: DataTypes.BIGINT,
|
|
type: DataTypes.BIGINT,
|
|
allowNull: true
|
|
allowNull: true
|
|
@@ -219,6 +235,10 @@ export const schema = {
|
|
allowNull: false,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
defaultValue: 0
|
|
},
|
|
},
|
|
|
|
+ name: {
|
|
|
|
+ type: DataTypes.STRING,
|
|
|
|
+ allowNull: false
|
|
|
|
+ },
|
|
location: {
|
|
location: {
|
|
type: DataTypes.STRING,
|
|
type: DataTypes.STRING,
|
|
allowNull: true
|
|
allowNull: true
|