Update User.ts
This commit is contained in:
@@ -5,25 +5,15 @@ const reqString = {
|
|||||||
required: true,
|
required: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
const reqNumber = {
|
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
const reqBoolean = {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
const userSchema = new mongoose.Schema({
|
const userSchema = new mongoose.Schema({
|
||||||
email: reqString,
|
email: reqString,
|
||||||
username: reqString,
|
username: reqString,
|
||||||
points: reqNumber,
|
points: Number,
|
||||||
owned: reqBoolean,
|
|
||||||
inventory : Array,
|
inventory : Array,
|
||||||
imageDescription: reqString,
|
id: reqString,
|
||||||
ButtonsOptions: Array
|
friends: Array,
|
||||||
});12
|
requests: Array,
|
||||||
|
})
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
model: mongoose.Model<any>;
|
model: mongoose.Model<any>;
|
||||||
@@ -32,16 +22,16 @@ export class User {
|
|||||||
this.model = mongoose.model('user', userSchema);
|
this.model = mongoose.model('user', userSchema);
|
||||||
this.upsert = { upsert: true };
|
this.upsert = { upsert: true };
|
||||||
}
|
}
|
||||||
async create(id: string, pickupLine: string, followUpLine: string, ButtonsOptions: Array<any>, colors: any, image: any, password: string) {
|
async create(email: string, username: string, points: number, inventory: Array<any>, id: string, friends: Array<any>, requests: Array<any>) {
|
||||||
const newEntry = new this.model({
|
const newEntry = new this.model({
|
||||||
|
email: email,
|
||||||
|
username: username,
|
||||||
|
points: points,
|
||||||
|
inventory: inventory,
|
||||||
id: id,
|
id: id,
|
||||||
pickupLine: pickupLine,
|
friends: friends,
|
||||||
followUpLine: followUpLine,
|
requests: requests,
|
||||||
ButtonsOptions: ButtonsOptions,
|
|
||||||
colors: colors,
|
|
||||||
image: image,
|
|
||||||
date: new Date().toISOString(),
|
|
||||||
password: password,
|
|
||||||
});
|
});
|
||||||
await newEntry.save();
|
await newEntry.save();
|
||||||
return newEntry;
|
return newEntry;
|
||||||
|
|||||||
Reference in New Issue
Block a user