2016-07-30 22:51:19 +02:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2023-03-19 16:39:04 +00:00
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Yavsc.Models.Relationship;
|
2023-03-26 21:48:25 +01:00
|
|
|
using Yavsc.Models.Identity;
|
|
|
|
|
using Yavsc.Models.Chat;
|
|
|
|
|
using Yavsc.Models.Bank;
|
|
|
|
|
using Yavsc.Models.Access;
|
2025-06-29 19:53:56 +01:00
|
|
|
using Yavsc.Abstract.Identity;
|
|
|
|
|
|
2016-07-30 22:51:19 +02:00
|
|
|
namespace Yavsc.Models
|
|
|
|
|
{
|
2023-04-05 22:29:40 +01:00
|
|
|
[Table("AspNetUsers")]
|
2025-06-29 19:53:56 +01:00
|
|
|
public class ApplicationUser : IdentityUser, IApplicationUser
|
2016-07-30 22:51:19 +02:00
|
|
|
{
|
2023-04-05 22:29:40 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Another me, as a byte array.TG7@Eu%80rufzkhbb
|
2017-03-29 10:38:37 +02:00
|
|
|
/// This value points a picture that may be used
|
|
|
|
|
/// to present the user
|
2016-09-23 12:29:50 +02:00
|
|
|
/// </summary>
|
2017-03-29 10:38:37 +02:00
|
|
|
/// <returns>the path to an user's image, relative to it's user dir<summary>
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <see>Startup.UserFilesOptions</see>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2017-03-29 10:38:37 +02:00
|
|
|
[MaxLength(512)]
|
2025-06-29 19:53:56 +01:00
|
|
|
public string? Avatar { get; set; }
|
2016-10-23 01:31:09 +02:00
|
|
|
|
|
|
|
|
[MaxLength(512)]
|
2025-06-29 19:53:56 +01:00
|
|
|
public string? FullName { get; set; }
|
2016-10-23 01:31:09 +02:00
|
|
|
|
2017-03-29 10:38:37 +02:00
|
|
|
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// WIP Paypal
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2023-03-19 16:39:04 +00:00
|
|
|
[Display(Name = "Account balance")]
|
2025-06-29 19:53:56 +01:00
|
|
|
public virtual AccountBalance? AccountBalance { get; set; }
|
2016-07-30 22:51:19 +02:00
|
|
|
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// User's posts
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2023-03-19 16:39:04 +00:00
|
|
|
[InverseProperty("Author"), JsonIgnore]
|
|
|
|
|
public virtual List<Blog.BlogPost> Posts { get; set; }
|
2016-07-30 22:51:19 +02:00
|
|
|
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// User's contact list
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2023-03-19 16:39:04 +00:00
|
|
|
[InverseProperty("Owner"), JsonIgnore]
|
2016-07-30 22:51:19 +02:00
|
|
|
public virtual List<Contact> Book { get; set; }
|
|
|
|
|
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// External devices using the API
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2023-03-19 16:39:04 +00:00
|
|
|
[InverseProperty("DeviceOwner"), JsonIgnore]
|
2019-05-24 20:17:24 +01:00
|
|
|
public virtual List<DeviceDeclaration> DeviceDeclaration { get; set; }
|
2017-03-29 10:38:37 +02:00
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
[InverseProperty("Owner"), JsonIgnore]
|
2018-01-02 16:35:03 +01:00
|
|
|
public virtual List<ChatConnection> Connections { get; set; }
|
2016-11-01 23:22:46 +01:00
|
|
|
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// User's circles
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2023-03-19 16:39:04 +00:00
|
|
|
[InverseProperty("Owner"), JsonIgnore]
|
2016-07-30 22:51:19 +02:00
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
public virtual List<Circle> Circles { get; set; }
|
2016-09-23 12:29:50 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Billing postal address
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2023-04-01 15:03:48 +01:00
|
|
|
[ForeignKey("PostalAddressId")]
|
|
|
|
|
public virtual Location? PostalAddress { get; set; }
|
2017-04-01 02:14:10 +02:00
|
|
|
public long? PostalAddressId { get; set; }
|
2016-07-30 22:51:19 +02:00
|
|
|
|
2016-09-23 12:29:50 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// User's Google calendar
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2018-04-14 19:33:44 +02:00
|
|
|
[MaxLength(512)]
|
2016-07-30 22:51:19 +02:00
|
|
|
public string DedicatedGoogleCalendar { get; set; }
|
|
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return this.Id + " " + this.AccountBalance?.Credits.ToString() + this.Email + " " + this.UserName + " $" + this.AccountBalance?.Credits.ToString();
|
2016-07-30 22:51:19 +02:00
|
|
|
}
|
2016-11-04 13:55:48 +01:00
|
|
|
|
2023-04-01 15:03:48 +01:00
|
|
|
public virtual List<BankIdentity> BankInfo { get; set; }
|
2017-03-29 10:38:37 +02:00
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
public long DiskQuota { get; set; } = 512 * 1024 * 1024;
|
|
|
|
|
public long DiskUsage { get; set; } = 0;
|
2017-01-13 16:31:40 +01:00
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
public long MaxFileSize { get; set; } = 512 * 1024 * 1024;
|
2018-01-02 16:35:03 +01:00
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
|
[InverseProperty("Owner")]
|
2017-01-13 16:31:40 +01:00
|
|
|
public virtual List<BlackListed> BlackList { get; set; }
|
2018-05-03 15:40:58 +02:00
|
|
|
|
|
|
|
|
public bool AllowMonthlyEmail { get; set; } = false;
|
2019-05-08 01:35:10 +01:00
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
|
[InverseProperty("Owner")]
|
2019-05-08 01:35:10 +01:00
|
|
|
public virtual List<ChatRoom> Rooms { get; set; }
|
|
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
|
[InverseProperty("User")]
|
2019-05-08 01:35:10 +01:00
|
|
|
public virtual List<ChatRoomAccess> RoomAccess { get; set; }
|
|
|
|
|
|
2023-03-19 16:39:04 +00:00
|
|
|
[JsonIgnore]
|
|
|
|
|
[InverseProperty("Member")]
|
2019-07-30 18:42:22 +02:00
|
|
|
public virtual List<CircleMember> Membership { get; set; }
|
|
|
|
|
|
2025-06-29 19:53:56 +01:00
|
|
|
IAccountBalance? IApplicationUser.AccountBalance => AccountBalance;
|
|
|
|
|
|
|
|
|
|
ILocation? IApplicationUser.PostalAddress { get => PostalAddress; }
|
2016-07-30 22:51:19 +02:00
|
|
|
}
|
|
|
|
|
}
|