Skip to content

Commit

Permalink
fix: 简化部分逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
afzw committed Jan 26, 2024
1 parent 1ecf4fa commit 49ddb9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/entities/auth/user.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ const userSchema = new Schema<UserProps, UserModelType, UserMethods, UserQueryHe
)

// 虚拟值
userSchema.virtual('symbol').get(function () {
return `${this.username}-${this.email}`
})
// userSchema.virtual('symbol').get(function () {
// return `${this.username}-${this.email}`
// })
// 定义用户集合实例方法
userSchema.method('isRole', function isRole(roleName: string, only = false) {
return only ? this.roles.includes(roleName) && this.roles.length === 1 : this.roles.includes(roleName)
Expand Down
2 changes: 0 additions & 2 deletions src/scripts/createAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ exports.start = async function start() {

const adminDoc: Partial<UserProps> = {
email: '[email protected]',
username: 'admin',
nickname: '系统管理员',
role: 'admin',
salt,
password
Expand Down

0 comments on commit 49ddb9d

Please sign in to comment.