push de la fleme
This commit is contained in:
37
models/Event.js
Normal file
37
models/Event.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const { v4: uuid, parse } = require('uuid');
|
||||
|
||||
class Event {
|
||||
members = [];
|
||||
constructor(title, subTitle, base64Banner, desc, date, were, maxMembers, authorId, id, members) {
|
||||
if (!id || parse(id)) {
|
||||
this.id = uuid(undefined, undefined, undefined);
|
||||
} else {
|
||||
this.id = id;
|
||||
}
|
||||
if (members) {
|
||||
this.members = members;
|
||||
}
|
||||
this.title = title;
|
||||
this.subTitle = subTitle;
|
||||
this.base64Banner = base64Banner;
|
||||
this.desc = desc;
|
||||
this.date = date;
|
||||
this.were = were;
|
||||
this.maxMembers = maxMembers;
|
||||
this.authorId = authorId;
|
||||
this.members.push(`${authorId}`)
|
||||
}
|
||||
addMember(memberId) {
|
||||
this.members.push(`${memberId}`);
|
||||
}
|
||||
getMembers() {
|
||||
return this.members;
|
||||
}
|
||||
getMemberCount() {
|
||||
return this.members.length;
|
||||
}
|
||||
removeMember(id) {
|
||||
this.members = this.members.filter(member => member !== id);
|
||||
}
|
||||
}
|
||||
module.exports = Event;
|
||||
44
models/User.js
Normal file
44
models/User.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const { v4: uuid, parse } = require('uuid');
|
||||
|
||||
/**
|
||||
* Represents a User object.
|
||||
*
|
||||
* @class User
|
||||
*/
|
||||
class User {
|
||||
firstName;
|
||||
lastName;
|
||||
/**
|
||||
* Creates a new user object.
|
||||
*
|
||||
* @constructor
|
||||
* @param {string} username - The username of the user.
|
||||
* @param {string} displayName - The display name of the user.
|
||||
* @param {string} passwordHash - The password hash of the user.
|
||||
* @param {string} [id] - The optional unique identifier of the user. If not provided or not a valid UUID, a new UUID will be generated.
|
||||
* @return {void}
|
||||
*/
|
||||
constructor(username, displayName, passwordHash, gdpr, id) {
|
||||
if (!id || parse(id)) {
|
||||
this.id = uuid(undefined, undefined, undefined);
|
||||
} else {
|
||||
this.id = id;
|
||||
}
|
||||
console.log(this.id)
|
||||
this.username = username;
|
||||
this.displayName = displayName;
|
||||
this.gdpr = gdpr;
|
||||
this.passwordHash = passwordHash;
|
||||
this.isAdmin = false;
|
||||
this.isDisabled = false
|
||||
}
|
||||
|
||||
setFirstName(firstName) {
|
||||
this.firstName = firstName
|
||||
}
|
||||
|
||||
setLastName(lastName) {
|
||||
this.lastName = lastName
|
||||
}
|
||||
}
|
||||
module.exports = User;
|
||||
Reference in New Issue
Block a user