From 72e825a12c3058f23978edfadb693999cb316530 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 7 Oct 2025 16:41:02 +0500 Subject: [PATCH] common: update subscription models --- .../Models/Responses/UserResponse.cs | 2 +- .../Interfaces/ISubscription.cs | 41 ------------------- .../Messages/SendSSEMessage.cs | 2 +- Streetwriters.Common/Models/Subscription.cs | 19 +++++---- 4 files changed, 12 insertions(+), 52 deletions(-) delete mode 100644 Streetwriters.Common/Interfaces/ISubscription.cs diff --git a/Notesnook.API/Models/Responses/UserResponse.cs b/Notesnook.API/Models/Responses/UserResponse.cs index 4c874dd..0481477 100644 --- a/Notesnook.API/Models/Responses/UserResponse.cs +++ b/Notesnook.API/Models/Responses/UserResponse.cs @@ -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; } diff --git a/Streetwriters.Common/Interfaces/ISubscription.cs b/Streetwriters.Common/Interfaces/ISubscription.cs deleted file mode 100644 index e56472a..0000000 --- a/Streetwriters.Common/Interfaces/ISubscription.cs +++ /dev/null @@ -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 . -*/ - -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))] - 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; } - } -} diff --git a/Streetwriters.Common/Messages/SendSSEMessage.cs b/Streetwriters.Common/Messages/SendSSEMessage.cs index 9a6b464..ec02268 100644 --- a/Streetwriters.Common/Messages/SendSSEMessage.cs +++ b/Streetwriters.Common/Messages/SendSSEMessage.cs @@ -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; } } } \ No newline at end of file diff --git a/Streetwriters.Common/Models/Subscription.cs b/Streetwriters.Common/Models/Subscription.cs index 9eab742..b8a8f88 100644 --- a/Streetwriters.Common/Models/Subscription.cs +++ b/Streetwriters.Common/Models/Subscription.cs @@ -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; }