Skip to content
Snippets Groups Projects
Commit 08df57c1 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

add profile fields and enum validation

parent b787b79c
No related branches found
No related tags found
3 merge requests!24Auth, Profile, News, Entry Card, File management,!21update feature/news_api branch,!19Profile and Entry Card
...@@ -14,7 +14,7 @@ export interface IProfile extends Document { ...@@ -14,7 +14,7 @@ export interface IProfile extends Document {
studentCardNumber: string; studentCardNumber: string;
roomNumber?: string; roomNumber?: string;
picture: string; picture: string;
role: Role.Admin | Role.Staff | Role.User; role: Role;
email?: string; email?: string;
name?: string; name?: string;
warnings: [IWarnings] | []; warnings: [IWarnings] | [];
...@@ -25,7 +25,14 @@ const ProfileSchema = new Schema({ ...@@ -25,7 +25,14 @@ const ProfileSchema = new Schema({
studentCardNumber: { type: String, required: true }, studentCardNumber: { type: String, required: true },
roomNumber: { type: String }, roomNumber: { type: String },
picture: { type: String }, picture: { type: String },
role: { type: String, required: true }, role: {
type: String,
enum: Object.keys(Role).map((k) => Role[k as any]),
required: true,
default: Role.User,
},
email: { type: String, required: true },
name: { type: String, required: true },
warnings: [WarningSchema], warnings: [WarningSchema],
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment