1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

update premium license and self host attr checks

This commit is contained in:
Kyle Spearrin
2017-08-14 12:08:57 -04:00
parent 9e566e90a9
commit 18cbc79dd2
6 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,11 @@
using Microsoft.AspNetCore.Http;
using System.ComponentModel.DataAnnotations;
namespace Bit.Core.Models.Api
{
public class UpdateLicenseRequestModel
{
[Required]
public IFormFile License { get; set; }
}
}

View File

@ -21,6 +21,7 @@ namespace Bit.Core.Models.Api
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
MaxStorageGb = user.MaxStorageGb;
License = new UserLicense(user, billing, licenseService);
Expiration = License.Expires;
}
public BillingResponseModel(User user)
@ -29,6 +30,7 @@ namespace Bit.Core.Models.Api
StorageName = user.Storage.HasValue ? Utilities.CoreHelpers.ReadableBytesSize(user.Storage.Value) : null;
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
MaxStorageGb = user.MaxStorageGb;
Expiration = user.PremiumExpirationDate;
}
public string StorageName { get; set; }
@ -39,6 +41,7 @@ namespace Bit.Core.Models.Api
public BillingInvoice UpcomingInvoice { get; set; }
public IEnumerable<BillingCharge> Charges { get; set; }
public UserLicense License { get; set; }
public DateTime? Expiration { get; set; }
}
public class BillingSource