forked from cosmicds/cds-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cosmicds#157 from Carifio24/hubble-merge-groups
Hubble merge groups
- Loading branch information
Showing
5 changed files
with
231 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/stories/hubbles_law/models/hubble_class_merge_group.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Sequelize, DataTypes, Model, InferAttributes, InferCreationAttributes } from "sequelize"; | ||
import { Class } from "../../../models"; | ||
|
||
export class HubbleClassMergeGroup extends Model<InferAttributes<HubbleClassMergeGroup>, InferCreationAttributes<HubbleClassMergeGroup>> { | ||
declare group_id: number; | ||
declare class_id: number; | ||
declare merge_order: number; | ||
} | ||
|
||
export function initializeHubbleClassMergeGroupModel(sequelize: Sequelize) { | ||
HubbleClassMergeGroup.init({ | ||
group_id: { | ||
type: DataTypes.INTEGER.UNSIGNED, | ||
allowNull: false, | ||
primaryKey: true, | ||
}, | ||
class_id: { | ||
type: DataTypes.INTEGER.UNSIGNED, | ||
allowNull: false, | ||
unique: true, | ||
primaryKey: true, | ||
references: { | ||
model: Class, | ||
key: "id", | ||
} | ||
}, | ||
merge_order: { | ||
type: DataTypes.INTEGER.UNSIGNED, | ||
allowNull: false, | ||
} | ||
}, { | ||
sequelize, | ||
indexes: [ | ||
{ | ||
fields: ["group_id"], | ||
}, | ||
{ | ||
fields: ["class_id"], | ||
}, | ||
] | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.