Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 45 lines 1.1 kB view raw
1import sequelize, { type Sequelize } from 'sequelize'; 2 3import { type DataTypes } from '../index.js'; 4 5const { Model } = sequelize; 6 7export type RuleLatestVersion = InstanceType< 8 ReturnType<typeof makeRuleLatestVersionModel> 9>; 10 11const makeRuleLatestVersionModel = ( 12 sequelize: Sequelize, 13 DataTypes: DataTypes, 14) => { 15 class RuleLatestVersion extends Model { 16 public declare readonly ruleId: string; 17 public declare readonly version: string; 18 } 19 20 /* Fields */ 21 RuleLatestVersion.init( 22 { 23 ruleId: { 24 type: DataTypes.STRING, 25 primaryKey: true, 26 }, 27 version: { 28 // Read version into JS as a string, not a date, because the date holds 29 // more digits of precision than JS can store, and we can't throw those 30 // away when we write this field's value out elsewhere. 31 type: DataTypes.STRING, 32 }, 33 }, 34 { 35 sequelize, 36 tableName: 'rules_latest_versions', 37 underscored: true, 38 timestamps: false, 39 }, 40 ); 41 42 return RuleLatestVersion; 43}; 44 45export default makeRuleLatestVersionModel;