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
+1
View File
@@ -4,6 +4,7 @@
exports.ArticleService = require('./mysql/article.service');
exports.CommentService = require('./mysql/comment.service');
exports.ProductService = require('./mysql/product.service');
exports.SkydiverProfileService = require('./mysql/skydiver-profile.service');
exports.TagService = require('./mysql/tag.service');
exports.UserService = require('./mysql/user.service');
//exports.HeroWarService = require('./mysql/herowars.service');
@@ -0,0 +1,16 @@
const DB = require('../../database/mysql');
const { SkydiverProfile } = DB;
class SkydiverProfileService {
static async getByUserId(userId) {
return SkydiverProfile.findByPk(userId);
}
static async upsert(userId, data) {
const [profile] = await SkydiverProfile.upsert({ userId, ...data });
return profile;
}
}
module.exports = SkydiverProfileService;