Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iyanfdezz committed Apr 25, 2024
1 parent 7020f11 commit 2bd1018
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webapp/e2e/test-environment-setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { MongoMemoryServer } = require('mongodb-memory-server');

const mongoose = require('mongoose');
const User = require('./user-model');
const bcrypt = require('bcrypt');

let mongoserver;
let userservice;
Expand Down
63 changes: 63 additions & 0 deletions webapp/e2e/user-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const mongoose = require('mongoose');

const userSchema = new mongoose.Schema({
username: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
createdAt: {
type: Date,
default: Date.now,
},
games: [{
gamemode: String,
correctAnswers: Number,
incorrectAnswers: Number,
points: Number,
avgTime: Number,
questions: [{
pregunta: String,
respuestas: [
String,
String,
String,
String
],
correcta: String,
respuesta: String
}]
}],
friends: [{
type: String,
ref: 'User'
}]
});

const User = mongoose.model('User', userSchema);

// Modelo para el grupo
const groupSchema = new mongoose.Schema({
name: {
type: String,
required: true,
unique: true // Asegura que no haya grupos con el mismo nombre
},
createdAt: {
type: Date,
default: Date.now
},
members: [{
type: String,
required: true
}]
});

const Group = mongoose.model('Group', groupSchema);



module.exports = { User, Group };

0 comments on commit 2bd1018

Please sign in to comment.