mirror of
https://github.com/filiprojek/nork.git
synced 2025-02-20 01:22:58 +01:00
- 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
41 lines
620 B
TypeScript
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)
|