|
|
|
@ -45,6 +45,26 @@ export class UsersService implements Users.IUsersService {
@@ -45,6 +45,26 @@ export class UsersService implements Users.IUsersService {
|
|
|
|
|
private readonly eventEmitter: EventEmitter2, |
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
async onModuleInit() { |
|
|
|
|
const users = await this.infoRepository |
|
|
|
|
.createQueryBuilder('it') |
|
|
|
|
.where('it.dateOfBirthStr IS NULL') |
|
|
|
|
.select('it.userId') |
|
|
|
|
.addSelect('it.dateOfBirth') |
|
|
|
|
.getMany() |
|
|
|
|
|
|
|
|
|
if (_.isEmpty(users)) return |
|
|
|
|
|
|
|
|
|
await Promise.all( |
|
|
|
|
users.map(async it => { |
|
|
|
|
if (!it.dateOfBirth) return |
|
|
|
|
|
|
|
|
|
const dateOfBirthStr = moment(it.dateOfBirth).locale('uk').format('DD MMMM') |
|
|
|
|
await this.infoRepository.update({ userId: it.userId }, { dateOfBirthStr }) |
|
|
|
|
}), |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async save(payload: Users.SaveUserPayload, userId?: number, notValidateLogin?: boolean) { |
|
|
|
|
await this.validateSavedData(payload) |
|
|
|
|
|
|
|
|
@ -215,6 +235,10 @@ export class UsersService implements Users.IUsersService {
@@ -215,6 +235,10 @@ export class UsersService implements Users.IUsersService {
|
|
|
|
|
dataToUpdateInfo.innerPhoneNumber = null |
|
|
|
|
if (dataToUpdateInfo.personalPhoneNumber === 'deleted') |
|
|
|
|
dataToUpdateInfo.personalPhoneNumber = null |
|
|
|
|
if (dataToUpdateInfo.dateOfBirth) |
|
|
|
|
dataToUpdateInfo.dateOfBirthStr = moment(dataToUpdateInfo.dateOfBirth) |
|
|
|
|
.locale('uk') |
|
|
|
|
.format('DD MMMM') |
|
|
|
|
|
|
|
|
|
if (_.has(payload, 'avatarUrl')) dataToUpdateInfo.avatarUrl = payload.avatarUrl |
|
|
|
|
|
|
|
|
|