mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Define routes, controllers of sessions
Work in progress, debugging
This commit is contained in:
1 parent
50443b96e0
commit
04edfdd0dc
13 files changed
+1835
-60
No files matched your search
@@ -1,3 +0,0 @@
|
||||
export { default as User } from './user.js'
|
||||
export { default as Session } from './session.js'
|
||||
export { default as Quest } from './quest.js'
|
||||
@@ -1,10 +1,15 @@
|
||||
import { model } from 'mongoose'
|
||||
import { Schema } from 'yaml'
|
||||
|
||||
export default model(
|
||||
const Quest = model(
|
||||
'Quest',
|
||||
{
|
||||
name: String,
|
||||
description: String,
|
||||
},
|
||||
{ timestamp: true }
|
||||
new Schema(
|
||||
{
|
||||
name: String,
|
||||
description: String,
|
||||
},
|
||||
{ timestamp: true }
|
||||
)
|
||||
)
|
||||
|
||||
export default Quest
|
||||
@@ -1,20 +1,24 @@
|
||||
import { model, Schema } from 'mongoose'
|
||||
|
||||
export default model(
|
||||
const Session = model(
|
||||
'Session',
|
||||
{
|
||||
name: String,
|
||||
containerId: String,
|
||||
user: {
|
||||
type: Schema.ObjectId,
|
||||
ref: 'User',
|
||||
new Schema(
|
||||
{
|
||||
name: String,
|
||||
containerId: String,
|
||||
user: {
|
||||
type: Schema.ObjectId,
|
||||
ref: 'User',
|
||||
},
|
||||
quest: {
|
||||
type: Schema.ObjectId,
|
||||
ref: 'Quest',
|
||||
},
|
||||
finishedAt: Date,
|
||||
terminals: [String],
|
||||
},
|
||||
quest: {
|
||||
type: Schema.ObjectId,
|
||||
ref: 'Quest',
|
||||
},
|
||||
finishedAt: Date,
|
||||
terminals: [String],
|
||||
},
|
||||
{ timestamps: true }
|
||||
{ timestamps: true }
|
||||
)
|
||||
)
|
||||
|
||||
export default Session
|
||||
@@ -1,7 +1,9 @@
|
||||
import mongoose from 'mongoose'
|
||||
import { model } from 'mongoose'
|
||||
|
||||
export default mongoose.model('User', {
|
||||
const User = model('User', {
|
||||
username: String,
|
||||
password: String,
|
||||
email: String,
|
||||
})
|
||||
|
||||
export default User
|
||||
Reference in new issue
Block a user