2024-09-26 00:47:08 +01:00
|
|
|
import { UserLevel } from "../enums/UserLevel";
|
|
|
|
|
2024-04-18 23:18:49 +01:00
|
|
|
export default class User {
|
2024-04-21 15:35:47 +01:00
|
|
|
public Id:number;
|
2024-09-26 00:47:08 +01:00
|
|
|
public UserLevel:UserLevel;
|
|
|
|
public get UserLevelString() {
|
|
|
|
return UserLevel[this.UserLevel];
|
|
|
|
}
|
2024-04-21 15:35:47 +01:00
|
|
|
public Username:string;
|
|
|
|
public PasswordSalt:string;
|
|
|
|
public PasswordHash:string;
|
2024-04-25 02:37:37 +01:00
|
|
|
public APIKey:string;
|
2024-04-21 15:35:47 +01:00
|
|
|
public CreatedByUserId:number;
|
|
|
|
public CreatedDatetime:Date;
|
2024-04-22 02:01:14 +01:00
|
|
|
public LastModifiedByUserId?:number;
|
|
|
|
public LastModifiedDatetime?:Date;
|
|
|
|
public DeletedByUserId?:number;
|
|
|
|
public DeletedDatetime?:Date;
|
2024-04-21 15:35:47 +01:00
|
|
|
public IsDeleted:boolean;
|
2024-04-18 23:18:49 +01:00
|
|
|
|
2024-09-26 00:47:08 +01:00
|
|
|
public constructor(id?:number, userLevel?:UserLevel, username?:string, passwordSalt?:string, passwordHash?:string, apiKey?:string, createdByUserId?:number, createdDateTime?:Date, lastModifiedByUserId?:number, lastModifiedDatetime?:Date, deletedByUserId?:number, deletedDatetime?:Date, isDeleted?:boolean) {
|
|
|
|
if (typeof(id) == "number" && typeof(userLevel) == "number" && typeof(username) == "string" && typeof(passwordHash) == "string" && typeof(passwordSalt) == "string" && typeof(apiKey) == "string" && typeof(createdByUserId) == "number" && createdDateTime instanceof Date && typeof(lastModifiedByUserId) == "number" && lastModifiedDatetime instanceof Date && typeof(deletedByUserId) == "number" && deletedDatetime instanceof Date && typeof(isDeleted) == "boolean") {
|
2024-04-21 15:35:47 +01:00
|
|
|
this.Id = id;
|
2024-09-26 00:47:08 +01:00
|
|
|
this.UserLevel = userLevel;
|
2024-04-21 15:35:47 +01:00
|
|
|
this.Username = username;
|
|
|
|
this.PasswordHash = passwordHash;
|
|
|
|
this.PasswordSalt = passwordSalt;
|
2024-04-25 02:37:37 +01:00
|
|
|
this.APIKey = apiKey;
|
2024-04-21 15:35:47 +01:00
|
|
|
this.CreatedByUserId = createdByUserId;
|
|
|
|
this.CreatedDatetime = createdDateTime;
|
|
|
|
this.LastModifiedByUserId = lastModifiedByUserId;
|
|
|
|
this.LastModifiedDatetime = lastModifiedDatetime;
|
|
|
|
this.DeletedByUserId = deletedByUserId;
|
|
|
|
this.DeletedDatetime = deletedDatetime;
|
|
|
|
this.IsDeleted = isDeleted;
|
|
|
|
} else {
|
|
|
|
this.Id = Number.MIN_VALUE;
|
2024-09-26 00:47:08 +01:00
|
|
|
this.UserLevel = UserLevel.Unknown;
|
2024-04-21 15:35:47 +01:00
|
|
|
this.Username = "";
|
|
|
|
this.PasswordHash = "";
|
|
|
|
this.PasswordSalt = "";
|
2024-04-25 02:37:37 +01:00
|
|
|
this.APIKey = "";
|
2024-04-21 15:35:47 +01:00
|
|
|
this.CreatedByUserId = Number.MIN_VALUE;
|
|
|
|
this.CreatedDatetime = new Date(0);
|
|
|
|
this.IsDeleted = false;
|
|
|
|
}
|
2024-04-18 23:18:49 +01:00
|
|
|
}
|
|
|
|
}
|