db/models/choreo.jsjavascript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultMatType = void 0;
const sequelize_1 = require("sequelize");
const db_1 = __importDefault(require("../db"));
exports.defaultMatType = "cheer";
/**
* @openapi
* components:
* schemas:
* Choreo:
* type: object
* required:
* - id
* - name
* - counts
* - matType
* properties:
* id:
* type: string
* format: uuid
* name:
* type: string
* counts:
* type: integer
* minimum: 0
* matType:
* type: string
* enum:
* - cheer
* - square
* - 1:2
* - 3:4
* default: cheer
* creatorId:
* type: string
* format: uuid
* updaterId:
* type: string
* format: uuid
*/
/**
* @typedef Choreo
* @property {UUID} id
* @property {string} name
* @property {number} counts
* @property {MatType} matType
* @property {UUID} UserId
* @property {UUID} creatorId
* @property {UUID} updaterId
* @memberof module:Models
*/
/**
* @typedef {('cheer'|'square'|'1:2'|'3:4')} MatType
* @memberof module:Models
*/
class Choreo extends sequelize_1.Model {
}
Choreo.init({
id: {
type: sequelize_1.DataTypes.UUID,
defaultValue: sequelize_1.DataTypes.UUIDV4,
primaryKey: true,
},
name: {
type: sequelize_1.DataTypes.STRING,
allowNull: false,
},
counts: {
type: sequelize_1.DataTypes.INTEGER,
allowNull: false,
validate: {
min: 0,
},
},
matType: {
type: sequelize_1.DataTypes.ENUM("cheer", "square", "1:2", "3:4"),
defaultValue: exports.defaultMatType,
allowNull: false,
},
createdAt: sequelize_1.DataTypes.DATE,
updatedAt: sequelize_1.DataTypes.DATE,
deletedAt: sequelize_1.DataTypes.DATE,
}, {
sequelize: db_1.default,
paranoid: true,
});
exports.default = Choreo;