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:
2026-04-25 22:32:30 +02:00
parent 07de469acb
commit ad7fc4384a
6 changed files with 122 additions and 0 deletions
+3
View File
@@ -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" });