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
@@ -0,0 +1,52 @@
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.createTable('skydiver_profile', {
userId: {
type: Sequelize.STRING(36),
allowNull: false,
primaryKey: true,
references: {
model: 'user',
key: 'id'
},
onDelete: 'CASCADE'
},
licence: {
type: Sequelize.INTEGER,
allowNull: true
},
poids: {
type: Sequelize.FLOAT,
allowNull: true
},
bg_image: {
type: Sequelize.STRING(255),
allowNull: true
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')
}
}, { transaction });
await transaction.commit();
} catch (err) {
await transaction.rollback();
throw err;
}
},
async down(queryInterface) {
await queryInterface.dropTable('skydiver_profile');
}
};