Files
DorkNet/DorkNet.Server/Data/Entities/CouponEntities.cs
Alexa d471b418b9 Import march-2020-03-10 from private repo (scrubbed 2026-05-27)
Targets Rec Room 2020.03.10 client (also serves 2020.03.06).

Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
  the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces dorknet-clientpatch-{key}.zip
  for v1-march-* Release uploads.
- .github/workflows/release.yml — on tag push publishes both
  dorknet-server-march_2020_03_10-win-x64.zip and
  dorknet-clientpatch-march_2020_03_10.zip as Release assets.

Same scrub rules as december; tools/build-patcher-zip.ps1 added to
the maintainer-side allow-list so it survives.
2026-05-27 01:06:12 +03:00

48 lines
1.5 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
/// <summary>
/// Admin-issued promo coupon. Players redeem by code via
/// <c>POST /api/coupons/v1/redeem/{code}</c>. Each redemption
/// inserts a <see cref="CouponRedemptionEntity"/> row (one per
/// (coupon, player) pair so we can enforce one-redeem-per-player).
/// </summary>
public class CouponEntity
{
public long Id { get; set; }
[MaxLength(64)]
public string Code { get; set; } = string.Empty;
[MaxLength(256)]
public string Description { get; set; } = string.Empty;
/// <summary>RewardType: 0=Currency, 1=ItemSlug, 2=Subscription.</summary>
public int RewardType { get; set; }
/// <summary>Currency type if RewardType=0; otherwise unused.</summary>
public int RewardCurrencyType { get; set; }
public long RewardAmount { get; set; }
/// <summary>Item slug if RewardType=1.</summary>
[MaxLength(64)]
public string RewardItemSlug { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
public int MaxRedemptions { get; set; } = 0;
public int RedemptionCount { get; set; } = 0;
public DateTime? ExpiresAt { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
public class CouponRedemptionEntity
{
public long Id { get; set; }
public long CouponId { get; set; }
public long PlayerId { get; set; }
public DateTime RedeemedAt { get; set; } = DateTime.UtcNow;
}