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 {
studentCardNumber: string;
roomNumber?: string;
picture: string;
role: Role.Admin | Role.Staff | Role.User;
role: Role;
email?: string;
name?: string;
warnings: [IWarnings] | [];
......@@ -25,7 +25,14 @@ const ProfileSchema = new Schema({
studentCardNumber: { type: String, required: true },
roomNumber: { 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],
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment