Files
Zumri-Backend/app/models/user/profile.model.js
Sathira Sri Sathara fd4e324571 feat: implement customer profile management and business application features
- Added customer profile controller with endpoints for retrieving, updating, and deactivating user profiles.
- Introduced address model and routes for managing user addresses.
- Created business application model and service for handling business applications, including approval and rejection processes.
- Developed business contact and credit account models to support business customer functionalities.
- Implemented settlement term model for managing payment terms.
- Added email templates for business application notifications (approved, rejected, received, and status changes).
- Enhanced validation schemas for customer and business inputs to ensure data integrity.
- Created unit tests for business application service and validation schemas to ensure functionality and correctness.
- Added migration scripts to set up new database tables and columns for customer and business features.
2026-09-03 14:58:26 +05:30

71 lines
1.8 KiB
JavaScript

/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/models/profile.model.js
module.exports = (sequelize, DataTypes) => {
const Profile = sequelize.define(
"Profile",
{
profile_id: {
type: DataTypes.STRING,
primaryKey: true,
},
user_id: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
collate: 'utf8mb4_general_ci'
},
theme: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: "light",
},
notificationsEnabled: {
type: DataTypes.BOOLEAN,
defaultValue: true,
},
profilePicture_id: {
type: DataTypes.STRING,
allowNull: true,
},
backgroundImage_id: {
type: DataTypes.STRING,
allowNull: true,
},
dob: {
type: DataTypes.DATE,
allowNull: true,
},
phone_number:{
type: DataTypes.STRING,
allowNull: true,
},
preferred_language: { type: DataTypes.ENUM("en", "si", "ta"), allowNull: false, defaultValue: "en" },
marketing_email_enabled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true },
marketing_push_enabled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false },
in_app_notifications_enabled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true },
},
{
tableName: "profiles",
timestamps: true,
},
);
Profile.associate = (db) => {
Profile.belongsTo(db.User, {
foreignKey: "user_id",
as: "user",
});
};
return Profile;
};