Skip to content
Snippets Groups Projects

update docker compose and add typedef for user

Merged Tuan Hoang Dinh Anh requested to merge tuanh/backend-core:main into main
4 files
+ 57
8
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 35
5
@@ -22,10 +22,15 @@ const rolesSchema = mongoose.Schema(
@@ -22,10 +22,15 @@ const rolesSchema = mongoose.Schema(
{ _id: false }
{ _id: false }
);
);
const userInfo = mongoose.Schema({
const userInfo = mongoose.Schema(
email: String,
{
providerId: String,
email: String,
});
providerId: String,
 
},
 
{
 
_id: false,
 
}
 
);
const userSchema = mongoose.Schema(
const userSchema = mongoose.Schema(
{
{
@@ -126,7 +131,32 @@ userSchema.pre('save', async function (next) {
@@ -126,7 +131,32 @@ userSchema.pre('save', async function (next) {
});
});
/**
/**
* @typedef User
* @typedef {Object} UserRoles
 
* @property {string[]} model_contributor - List of model contributors
 
* @property {string[]} tenant_admin - List of tenant admins
 
* @property {string[]} model_member - List of model members
 
*/
 
 
/**
 
* @typedef {Object} UserInfo
 
* @property {string} email - The email of the user
 
* @property {string} providerId - The provider ID of the user
 
*/
 
 
/**
 
* @typedef {Object} User
 
* @property {string} name
 
* @property {string} email
 
* @property {string} password
 
* @property {string} role
 
* @property {UserRoles} roles
 
* @property {boolean} email_verified
 
* @property {string} [image_file]
 
* @property {string} provider
 
* @property {string} uid
 
* @property {UserInfo[]} provider_data
 
* @property {Date} createdAt
 
* @property {Date} updatedAt
*/
*/
const User = mongoose.model('User', userSchema);
const User = mongoose.model('User', userSchema);
Loading