Auth: added
This commit is contained in:
49
api/src/models/Project.ts
Normal file
49
api/src/models/Project.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { DataTypes, Model } from 'sequelize'
|
||||
import path from 'path'
|
||||
import db from '../config/sequelize.config'
|
||||
import User from './User'
|
||||
import Client from './Client'
|
||||
|
||||
class Instance extends Model {}
|
||||
|
||||
Instance.init(
|
||||
{
|
||||
_id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
hourlyRate: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true
|
||||
},
|
||||
client_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: Client,
|
||||
key: '_id'
|
||||
}
|
||||
},
|
||||
author_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: User,
|
||||
key: '_id'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
sequelize: db,
|
||||
tableName: path.basename(__filename).split('.')[0].toLowerCase()
|
||||
}
|
||||
)
|
||||
|
||||
export default Instance
|
||||
Reference in New Issue
Block a user