Merge pull request #128 from SyncrowIOT/roles-and-permissions

Roles and permissions
This commit is contained in:
yousef-khriasat-uba
2024-10-27 15:48:25 +03:00
committed by GitHub
2 changed files with 7 additions and 9 deletions
@@ -1,14 +1,10 @@
import { SourceType } from '@app/common/constants/source-type.enum';
import { Entity, Column, PrimaryColumn, Index } from 'typeorm';
import { Entity, Column, PrimaryColumn, Unique } from 'typeorm';
@Entity('device-status-log')
@Index('logTime_idx', ['eventTime'])
@Unique('event_time_idx', ['eventTime'])
export class DeviceStatusLogEntity {
@PrimaryColumn({
type: 'int',
generated: true,
unsigned: true,
})
@Column({ type: 'int', generated: true, unsigned: true })
id: number;
@Column({ type: 'text' })
+4 -2
View File
@@ -256,11 +256,13 @@ export class UserAuthService {
throw new BadRequestException('You entered wrong otp');
}
if (otp.expiryTime < new Date() || fromNewPassword) {
if (otp.expiryTime < new Date()) {
await this.otpRepository.delete(otp.uuid);
throw new BadRequestException('OTP expired');
}
if (fromNewPassword) {
await this.otpRepository.delete(otp.uuid);
}
if (data.type == OtpType.VERIFICATION) {
await this.userRepository.update(
{ email: data.email },