Filip Rojek d8b859850e changes:
- norkconfig se generuje lepe a actually ho pouzivam
 - pri vytvareni projektu je mozne vybrat si orm (mongoose & sequlize)
 - default modely pro db se kopiruji na zaklade parametru db z norkconfigu
 - updatnutej ts skeleton
 - dropnul jsem support pro js
2022-07-30 22:28:06 +02:00

41 lines
620 B
TypeScript

import path from 'path'
import { Schema, model } from 'mongoose'
export const schemaName = path.basename(__filename).split('.')[0]
const schema = new Schema(
{
username: {
type: String,
required: true
},
email: {
type: String,
required: true,
unique: true
},
password: {
type: String,
required: true
},
domains: [
{
role: Number,
domain_id: String
}
],
verification_code: {
type: Number,
length: 6
},
verified: {
type: Boolean,
default: false
}
},
{
timestamps: true
}
)
export default model(path.basename(__filename).split('.')[0], schema)