quanyoumi/backend/models/Activity.js

54 lines
1.2 KiB
JavaScript

const { DataTypes } = require('sequelize');
const sequelize = require('./db');
const Activity = sequelize.define('Activity', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
title: {
type: DataTypes.STRING,
allowNull: false
},
description: DataTypes.TEXT,
location: DataTypes.STRING,
locationLat: DataTypes.DECIMAL(10, 7),
locationLng: DataTypes.DECIMAL(10, 7),
startTime: DataTypes.DATE,
endTime: DataTypes.DATE,
registrationDeadline: DataTypes.DATE,
maxParticipants: DataTypes.INTEGER,
status: {
type: DataTypes.ENUM('upcoming', 'ongoing', 'completed'),
defaultValue: 'upcoming'
},
registrationEnabled: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: '报名开关'
},
coverImage: DataTypes.STRING,
price: {
type: DataTypes.DECIMAL(10, 2),
defaultValue: 0,
comment: '人均费用'
},
budget: {
type: DataTypes.DECIMAL(10, 2),
defaultValue: 0,
comment: '活动预算'
},
danmakuEnabled: {
type: DataTypes.BOOLEAN,
defaultValue: false,
comment: '弹幕开关'
},
danmakuContent: {
type: DataTypes.TEXT,
comment: '弹幕内容JSON'
}
});
module.exports = Activity;