yavsc/Yavsc.Server/Models/ApplicationUser.cs

106 lines
3.2 KiB
C#

using System.Collections.Generic;
using Microsoft.AspNet.Identity.EntityFramework;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models
{
8 years ago
using Models.Relationship;
using Models.Identity;
using Models.Chat;
using Models.Bank;
using Models.Access;
8 years ago
using Newtonsoft.Json;
7 years ago
public class ApplicationUser : IdentityUser
{
/// <summary>
/// Another me, as a byte array.
/// This value points a picture that may be used
/// to present the user
/// </summary>
/// <returns>the path to an user's image, relative to it's user dir<summary>
/// <see>Startup.UserFilesOptions</see>
/// </summary>
/// <returns></returns>
[MaxLength(512)]
public string Avatar { get; set; }
8 years ago
[MaxLength(512)]
public string FullName { get; set; }
/// <summary>
/// WIP Paypal
/// </summary>
/// <returns></returns>
[Display(Name="Account balance")]
public virtual AccountBalance AccountBalance { get; set; }
/// <summary>
/// User's posts
/// </summary>
/// <returns></returns>
8 years ago
[InverseProperty("Author"),JsonIgnore]
7 years ago
public virtual List<Blog.BlogPost> Posts { get; set; }
/// <summary>
/// User's contact list
/// </summary>
/// <returns></returns>
8 years ago
[InverseProperty("Owner"),JsonIgnore]
public virtual List<Contact> Book { get; set; }
/// <summary>
/// External devices using the API
/// </summary>
/// <returns></returns>
8 years ago
[InverseProperty("DeviceOwner"),JsonIgnore]
public virtual List<GoogleCloudMobileDeclaration> Devices { get; set; }
8 years ago
[InverseProperty("Owner"),JsonIgnore]
7 years ago
public virtual List<ChatConnection> Connections { get; set; }
8 years ago
/// <summary>
/// User's circles
/// </summary>
/// <returns></returns>
8 years ago
[InverseProperty("Owner"),JsonIgnore]
public virtual List<Circle> Circles { get; set; }
/// <summary>
/// Billing postal address
/// </summary>
/// <returns></returns>
[ForeignKeyAttribute("PostalAddressId")]
public virtual Location PostalAddress { get; set; }
public long? PostalAddressId { get; set; }
/// <summary>
/// User's Google calendar
/// </summary>
/// <returns></returns>
7 years ago
[MaxLength(512)]
public string DedicatedGoogleCalendar { get; set; }
public override string ToString() {
return this.Id+" "+this.AccountBalance?.Credits.ToString()+this.Email+" "+this.UserName+" $"+this.AccountBalance?.Credits.ToString();
}
8 years ago
public BankIdentity BankInfo { get; set; }
8 years ago
public long DiskQuota { get; set; } = 512*1024*1024;
public long DiskUsage { get; set; } = 0;
7 years ago
public long MaxFileSize { get; set; } = 512*1024*1024;
[JsonIgnore][InverseProperty("Owner")]
public virtual List<BlackListed> BlackList { get; set; }
6 years ago
public bool AllowMonthlyEmail { get; set; } = false;
}
}