Skip to content
Snippets Groups Projects
Commit fd77633c authored by alrwasheda's avatar alrwasheda :speech_balloon:
Browse files

boatType Model

parent e9a58957
No related branches found
No related tags found
No related merge requests found
import { Sequelize, DataTypes, Model, Optional } from "sequelize";
interface BoatTypeAttributes {
id: string;
name: string;
seats: number;
}
export interface BoatTypeInput extends Optional<BoatTypeAttributes, "id"> {}
class BoatType
extends Model<BoatTypeAttributes, BoatTypeInput>
implements BoatTypeAttributes
{
declare id: string;
declare name: string;
declare seats: number;
declare readonly createdAt: Date;
declare readonly updatedAt: Date;
}
export const initBoatType = async (sequelizeConnection: Sequelize) => {
BoatType.init(
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
allowNull: false,
},
name: {
type: new DataTypes.STRING(),
allowNull: false,
},
seats: {
type: new DataTypes.INTEGER(),
allowNull: false,
},
},
{
tableName: "boatType",
sequelize: sequelizeConnection,
}
);
};
export default BoatType;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment