open source Notesnook API

This commit is contained in:
Abdullah Atta
2022-12-28 16:20:25 +05:00
parent cf406454cd
commit d2217adce7
85 changed files with 4137 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Streetwriters.Common.Enums;
using Streetwriters.Common.Interfaces;
namespace Streetwriters.Common.Models
{
public class Client : IClient
{
public string Id { get; set; }
public string Name { get; set; }
public string[] ProductIds { get; set; }
public ApplicationType Type { get; set; }
public ApplicationType AppId { get; set; }
public string SenderEmail { get; set; }
public string SenderName { get; set; }
public string WelcomeEmailTemplateId { get; set; }
}
}
@@ -0,0 +1,12 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using Streetwriters.Common.Interfaces;
namespace Streetwriters.Common.Models
{
public class SubscriptionResponse : Response
{
[JsonPropertyName("subscription")]
public ISubscription Subscription { get; set; }
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace Streetwriters.Common.Models
{
public class MFAConfig
{
public bool IsEnabled { get; set; }
public string PrimaryMethod { get; set; }
public string SecondaryMethod { get; set; }
public int RemainingValidCodes { get; set; }
}
}
+36
View File
@@ -0,0 +1,36 @@
// Streetwriters.Common.Models.Offer
using System.Collections.Generic;
using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Streetwriters.Common.Enums;
using Streetwriters.Common.Interfaces;
using Streetwriters.Data.Attributes;
namespace Streetwriters.Common.Models
{
[BsonCollection("subscriptions", "offers")]
public class Offer : IOffer
{
public Offer()
{
Id = ObjectId.GenerateNewId().ToString();
}
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("appId")]
public ApplicationType AppId { get; set; }
[JsonPropertyName("promoCode")]
public string PromoCode { get; set; }
[JsonPropertyName("codes")]
public PromoCode[] Codes { get; set; }
}
}
+21
View File
@@ -0,0 +1,21 @@
// Streetwriters.Common.Models.Offer
using System.Collections.Generic;
using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Streetwriters.Common.Enums;
using Streetwriters.Common.Interfaces;
namespace Streetwriters.Common.Models
{
public class PromoCode
{
[JsonPropertyName("provider")]
public SubscriptionProvider Provider { get; set; }
[JsonPropertyName("code")]
public string Code { get; set; }
}
}
+13
View File
@@ -0,0 +1,13 @@
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Streetwriters.Common.Interfaces;
namespace Streetwriters.Common.Models
{
public class Response : IResponse
{
[JsonIgnore]
public bool Success { get; set; }
public int StatusCode { get; set; }
}
}
+124
View File
@@ -0,0 +1,124 @@
using AspNetCore.Identity.Mongo.Model;
using Streetwriters.Data.Attributes;
namespace Streetwriters.Common.Models
{
[BsonCollection("identity", "roles")]
public class Role : MongoRole
{
// [DataMember(Name = "email")]
// [BsonElement("email")]
// public string Email
// {
// get; set;
// }
// [DataMember(Name = "isEmailConfirmed")]
// [BsonElement("isEmailConfirmed")]
// public bool IsEmailConfirmed { get; set; }
// [DataMember(Name = "username")]
// [BsonElement("username")]
// public string Username
// {
// get; set;
// }
// [BsonId]
// [BsonRepresentation(BsonType.ObjectId)]
// public string Id
// {
// get; set;
// }
// [IgnoreDataMember]
// [BsonElement("passwordHash")]
// public string PasswordHash
// {
// get; set;
// }
// [DataMember(Name = "salt")]
// public string Salt
// {
// get; set;
// }
}
/*
public class Picture
{
[DataMember(Name = "thumbnail")]
public string Thumbnail
{
get; set;
}
[DataMember(Name = "full")]
public string Full
{
get; set;
}
}
public class Streetwriters
{
[DataMember(Name = "fullName")]
public string FullName
{
get; set;
}
[DataMember(Name = "biography")]
[StringLength(240)]
public string Biography
{
get; set;
}
[DataMember(Name = "favoriteWords")]
public string FavoriteWords
{
get; set;
}
[DataMember(Name = "profilePicture")]
public Picture ProfilePicture
{
get; set;
}
[DataMember(Name = "followers")]
public string[] Followers
{
get; set;
}
[DataMember(Name = "following")]
public string[] Following
{
get; set;
}
[DataMember(Name = "website")]
[Url]
public string Website
{
get; set;
}
[DataMember(Name = "instagram")]
public string Instagram
{
get; set;
}
[DataMember(Name = "twitter")]
public string Twitter
{
get; set;
}
} */
}
@@ -0,0 +1,63 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Streetwriters.Common.Enums;
using Streetwriters.Common.Interfaces;
using Streetwriters.Data.Attributes;
namespace Streetwriters.Common.Models
{
[BsonCollection("subscriptions", "subscriptions")]
public class Subscription : ISubscription
{
public Subscription()
{
Id = ObjectId.GenerateNewId().ToString();
}
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("userId")]
public string UserId { get; set; }
[JsonIgnore]
public string OrderId { get; set; }
[JsonIgnore]
public string SubscriptionId { get; set; }
[BsonRepresentation(BsonType.Int32)]
[JsonPropertyName("appId")]
public ApplicationType AppId { get; set; }
[JsonPropertyName("start")]
public long StartDate { get; set; }
[JsonPropertyName("expiry")]
public long ExpiryDate { get; set; }
[BsonRepresentation(BsonType.Int32)]
[JsonPropertyName("provider")]
public SubscriptionProvider Provider { get; set; }
[BsonRepresentation(BsonType.Int32)]
[JsonPropertyName("type")]
public SubscriptionType Type { get; set; }
[JsonPropertyName("cancelURL")]
public string CancelURL { get; set; }
[JsonPropertyName("updateURL")]
public string UpdateURL { get; set; }
[JsonPropertyName("productId")]
public string ProductId { get; set; }
[JsonIgnore]
public int TrialExtensionCount { get; set; }
}
}
+12
View File
@@ -0,0 +1,12 @@
using AspNetCore.Identity.Mongo.Model;
using Streetwriters.Data.Attributes;
namespace Streetwriters.Common.Models
{
[BsonCollection("identity", "users")]
public class User : MongoUser
{
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.Text.Json.Serialization;
namespace Streetwriters.Common.Models
{
public class UserModel
{
[JsonPropertyName("id")]
public string UserId { get; set; }
[JsonPropertyName("email")]
public string Email { get; set; }
[JsonPropertyName("phoneNumber")]
public string PhoneNumber { get; set; }
[JsonPropertyName("isEmailConfirmed")]
public bool IsEmailConfirmed { get; set; }
[JsonPropertyName("mfa")]
public MFAConfig MFA { get; set; }
}
}