91 lines
2.8 KiB
C#
91 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using AyaNova.Biz;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Newtonsoft.Json;
|
|
namespace AyaNova.Models
|
|
{
|
|
|
|
public class dtUser//used to return user object without auth related fields in UserGet route
|
|
{
|
|
public dtUser()
|
|
{
|
|
Tags = new List<string>();
|
|
}
|
|
public long Id { get; set; }
|
|
public uint Concurrency { get; set; }
|
|
public bool Active { get; set; }
|
|
[Required, MaxLength(255)]
|
|
public string Name { get; set; }
|
|
public AuthorizationRoles Roles { get; set; }
|
|
public UserType UserType { get; set; }
|
|
public string EmployeeNumber { get; set; }
|
|
public string Notes { get; set; }
|
|
public long? CustomerId { get; set; }
|
|
public long? HeadOfficeId { get; set; }
|
|
public long? SubVendorId { get; set; }
|
|
public string Wiki { get; set; }
|
|
public string CustomFields { get; set; }
|
|
public List<string> Tags { get; set; }
|
|
}//eoc
|
|
|
|
public class User
|
|
{
|
|
public long Id { get; set; }
|
|
public uint Concurrency { get; set; }
|
|
|
|
[Required]
|
|
public bool Active { get; set; }
|
|
[Required, MaxLength(255)]
|
|
public string Name { get; set; }
|
|
|
|
public string Login { get; set; }
|
|
public string Password { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public string Salt { get; set; }
|
|
[JsonIgnore]
|
|
public string CurrentAuthToken { get; set; }
|
|
[JsonIgnore]
|
|
public string DlKey { get; set; }
|
|
[JsonIgnore]
|
|
public DateTime? DlKeyExpire { get; set; }
|
|
|
|
[Required]
|
|
public AuthorizationRoles Roles { get; set; }
|
|
[Required]
|
|
public UserType UserType { get; set; }
|
|
[MaxLength(255)]
|
|
public string EmployeeNumber { get; set; }
|
|
public string Notes { get; set; }
|
|
public long? CustomerId { get; set; }
|
|
public long? HeadOfficeId { get; set; }
|
|
public long? SubVendorId { get; set; }
|
|
public string Wiki { get; set; }
|
|
public string CustomFields { get; set; }
|
|
|
|
public List<string> Tags { get; set; }
|
|
|
|
//relations
|
|
//https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns
|
|
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
|
|
public UserOptions UserOptions { get; set; }
|
|
|
|
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
|
|
public Widget Widget { get; set; }
|
|
|
|
public User()
|
|
{
|
|
Tags = new List<string>();
|
|
}
|
|
|
|
public bool IsTech
|
|
{
|
|
get
|
|
{
|
|
return this.UserType == UserType.Subcontractor || this.UserType == UserType.Schedulable;
|
|
}
|
|
}
|
|
|
|
}//eoc
|
|
} |