mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
Add profile picture, region, and timezone fields to UserEntity
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import { DeviceUserPermissionEntity } from '../../device-user-permission/entities/device.user.permission.entity';
|
import { DeviceUserPermissionEntity } from '../../device-user-permission/entities/device.user.permission.entity';
|
||||||
import { Column, Entity, OneToMany } from 'typeorm';
|
import { Column, Entity, ManyToOne, OneToMany } from 'typeorm';
|
||||||
import { UserDto } from '../dtos';
|
import { UserDto } from '../dtos';
|
||||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||||
import { UserSpaceEntity } from '../../user-space/entities';
|
import { UserSpaceEntity } from '../../user-space/entities';
|
||||||
@ -7,6 +7,9 @@ import { UserRoleEntity } from '../../user-role/entities';
|
|||||||
import { DeviceNotificationEntity } from '../../device-notification/entities';
|
import { DeviceNotificationEntity } from '../../device-notification/entities';
|
||||||
import { UserNotificationEntity } from '../../user-notification/entities';
|
import { UserNotificationEntity } from '../../user-notification/entities';
|
||||||
import { DeviceEntity } from '../../device/entities';
|
import { DeviceEntity } from '../../device/entities';
|
||||||
|
import { defaultProfilePicture } from '@app/common/constants/default.profile.picture';
|
||||||
|
import { RegionEntity } from '../../region/entities';
|
||||||
|
import { TimeZoneEntity } from '../../timezone/entities';
|
||||||
|
|
||||||
@Entity({ name: 'user' })
|
@Entity({ name: 'user' })
|
||||||
export class UserEntity extends AbstractEntity<UserDto> {
|
export class UserEntity extends AbstractEntity<UserDto> {
|
||||||
@ -17,6 +20,13 @@ export class UserEntity extends AbstractEntity<UserDto> {
|
|||||||
})
|
})
|
||||||
public uuid: string;
|
public uuid: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'text',
|
||||||
|
default: defaultProfilePicture,
|
||||||
|
})
|
||||||
|
public profilePicture: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
unique: true,
|
unique: true,
|
||||||
@ -78,6 +88,12 @@ export class UserEntity extends AbstractEntity<UserDto> {
|
|||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
roles: UserRoleEntity[];
|
roles: UserRoleEntity[];
|
||||||
|
@ManyToOne(() => RegionEntity, (region) => region.users, { nullable: true })
|
||||||
|
region: RegionEntity;
|
||||||
|
@ManyToOne(() => TimeZoneEntity, (timezone) => timezone.users, {
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
timezone: TimeZoneEntity;
|
||||||
constructor(partial: Partial<UserEntity>) {
|
constructor(partial: Partial<UserEntity>) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
Reference in New Issue
Block a user