QrRapido/Models/User.cs
Ricardo Carneiro 16a9720a12
All checks were successful
Deploy QR Rapido / test (push) Successful in 59s
Deploy QR Rapido / build-and-push (push) Successful in 9m57s
Deploy QR Rapido / deploy-staging (push) Has been skipped
Deploy QR Rapido / deploy-production (push) Successful in 2m11s
feat: qrcode por creditos.
2026-01-26 20:13:45 -03:00

73 lines
2.4 KiB
C#

using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace QRRapidoApp.Models
{
public class User
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; } = string.Empty;
[BsonElement("email")]
public string Email { get; set; } = string.Empty;
[BsonElement("name")]
public string Name { get; set; } = string.Empty;
[BsonElement("provider")]
public string Provider { get; set; } = string.Empty; // Google, Microsoft
[BsonElement("providerId")]
public string ProviderId { get; set; } = string.Empty;
[BsonElement("isPremium")]
public bool IsPremium { get; set; } = false;
[BsonElement("createdAt")]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[BsonElement("premiumExpiresAt")]
public DateTime? PremiumExpiresAt { get; set; }
[BsonElement("premiumCancelledAt")]
public DateTime? PremiumCancelledAt { get; set; } // ADICIONADO: Data do cancelamento
[BsonElement("lastLoginAt")]
public DateTime LastLoginAt { get; set; } = DateTime.UtcNow;
[BsonElement("qrHistoryIds")]
public List<string> QRHistoryIds { get; set; } = new();
[BsonElement("stripeCustomerId")]
public string? StripeCustomerId { get; set; }
[BsonElement("stripeSubscriptionId")]
public string? StripeSubscriptionId { get; set; }
[BsonElement("subscriptionStartedAt")]
public DateTime? SubscriptionStartedAt { get; set; } // Data de início da assinatura atual
[BsonElement("preferredLanguage")]
public string PreferredLanguage { get; set; } = "pt-BR";
[BsonElement("dailyQRCount")]
public int DailyQRCount { get; set; } = 0;
[BsonElement("lastQRDate")]
public DateTime LastQRDate { get; set; } = DateTime.UtcNow.Date;
[BsonElement("totalQRGenerated")]
public int TotalQRGenerated { get; set; } = 0;
// NEW: Credit System
[BsonElement("credits")]
public int Credits { get; set; } = 0;
[BsonElement("freeQRsUsed")]
public int FreeQRsUsed { get; set; } = 0; // Tracks usage of the 5 free QRs limit
[BsonElement("historyHashes")]
public List<string> HistoryHashes { get; set; } = new(); // Stores SHA256 hashes of generated content to prevent double charging
}
}