common: update subscription models

This commit is contained in:
Abdullah Atta
2025-10-07 16:41:02 +05:00
committed by Abdullah Atta
parent 8aeeba0eeb
commit 72e825a12c
4 changed files with 12 additions and 52 deletions

View File

@@ -20,7 +20,7 @@ namespace Notesnook.API.Models.Responses
public InboxKeys? InboxKeys { get; set; }
[JsonPropertyName("subscription")]
public ISubscription? Subscription { get; set; }
public Subscription? Subscription { get; set; }
[JsonPropertyName("storageUsed")]
public long StorageUsed { get; set; }

View File

@@ -1,41 +0,0 @@
/*
This file is part of the Notesnook Sync Server project (https://notesnook.com/)
Copyright (C) 2023 Streetwriters (Private) Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the Affero GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Affero GNU General Public License for more details.
You should have received a copy of the Affero GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Streetwriters.Common.Attributes;
using Streetwriters.Common.Converters;
using Streetwriters.Common.Enums;
using Streetwriters.Common.Models;
namespace Streetwriters.Common.Interfaces
{
[JsonInterfaceConverter(typeof(InterfaceConverter<ISubscription, Subscription>))]
public interface ISubscription : IDocument
{
string UserId { get; set; }
ApplicationType AppId { get; set; }
SubscriptionProvider Provider { get; set; }
long StartDate { get; set; }
long ExpiryDate { get; set; }
SubscriptionType Type { get; set; }
string OrderId { get; set; }
string SubscriptionId { get; set; }
}
}

View File

@@ -43,6 +43,6 @@ namespace Streetwriters.Common.Messages
public Message Message { get; set; }
[JsonPropertyName("originTokenId")]
public string OriginTokenId { get; set; }
public string? OriginTokenId { get; set; }
}
}

View File

@@ -28,7 +28,7 @@ using Streetwriters.Common.Interfaces;
namespace Streetwriters.Common.Models
{
public class Subscription : ISubscription
public class Subscription
{
public Subscription()
{
@@ -41,16 +41,17 @@ namespace Streetwriters.Common.Models
public string Id { get; set; }
[JsonPropertyName("userId")]
public string UserId { get; set; }
public required string UserId { get; set; }
[JsonIgnore]
public string OrderId { get; set; }
public string? OrderId { get; set; }
[JsonIgnore]
public string SubscriptionId { get; set; }
public string? SubscriptionId { get; set; }
[BsonRepresentation(BsonType.Int32)]
[JsonPropertyName("appId")]
public ApplicationType AppId { get; set; }
public required ApplicationType AppId { get; set; }
[JsonPropertyName("start")]
public long StartDate { get; set; }
@@ -68,16 +69,16 @@ namespace Streetwriters.Common.Models
public SubscriptionType Type { get; set; }
[JsonPropertyName("cancelURL")]
public string CancelURL { get; set; }
public string? CancelURL { get; set; }
[JsonPropertyName("updateURL")]
public string UpdateURL { get; set; }
public string? UpdateURL { get; set; }
[JsonPropertyName("googlePurchaseToken")]
public string? GooglePurchaseToken { get; set; }
[JsonPropertyName("productId")]
public string ProductId { get; set; }
public string? ProductId { get; set; }
[JsonIgnore]
public int TrialExtensionCount { get; set; }
@@ -86,7 +87,7 @@ namespace Streetwriters.Common.Models
public long TrialExpiryDate { get; set; }
[JsonPropertyName("trialsAvailed")]
public SubscriptionPlan[] TrialsAvailed { get; set; }
public SubscriptionPlan[]? TrialsAvailed { get; set; }
[JsonPropertyName("updatedAt")]
public long UpdatedAt { get; set; }