feat(skydiver-profile): add SkydiverProfile MySQL model and service
Introduces the skydiver_profile table as an optional 1-to-1 extension of the user table, holding skydive-specific fields (licence, poids, bg_image). Wired up with Sequelize associations and a service with upsert support. Migration, model, relationships, and service layer all included.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
const DB = require('../mysql');
|
||||
|
||||
const associate = () => {
|
||||
DB.User.hasOne(DB.SkydiverProfile, { as: 'skydiverProfile', foreignKey: 'userId', onDelete: 'CASCADE' });
|
||||
DB.SkydiverProfile.belongsTo(DB.User, { as: 'user', foreignKey: 'userId' });
|
||||
|
||||
DB.Article.belongsToMany(DB.Tag, { as: 'articleTags', through: DB.TagList, foreignKey: "articleId", otherKey: "tagName", onDelete: "CASCADE" });
|
||||
DB.Product.belongsToMany(DB.Tag, { as: 'productTags', through: DB.ProductTagXref, foreignKey: "productId", otherKey: "tagName", onDelete: "CASCADE" });
|
||||
DB.Article.belongsToMany(DB.User, { as: 'articleFavoriteUsers', through: DB.Favorite, foreignKey: "articleId", otherKey: "userId", onDelete: "CASCADE" });
|
||||
|
||||
Reference in New Issue
Block a user