forked from gongxuegit/tiku-backend.net
feat: add referral growth endpoints
This commit is contained in:
103
Tiku.Api/Contracts/ReferralDtos.cs
Normal file
103
Tiku.Api/Contracts/ReferralDtos.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using Tiku.Application.Growth;
|
||||
|
||||
namespace Tiku.Api.Contracts;
|
||||
|
||||
public sealed class ReferralTenantQueryDto
|
||||
{
|
||||
[StringLength(100)]
|
||||
public string? TenantCode { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ReferralInviteDto
|
||||
{
|
||||
[StringLength(100)]
|
||||
public string? Channel { get; set; }
|
||||
|
||||
[StringLength(2048)]
|
||||
public string? LandingPath { get; set; }
|
||||
|
||||
public ReferralInviteCommand ToCommand()
|
||||
{
|
||||
return new ReferralInviteCommand(Channel, LandingPath);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ResolveReferralDto
|
||||
{
|
||||
[StringLength(100)]
|
||||
public string? Code { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? TenantCode { get; set; }
|
||||
|
||||
public ResolveReferralCommand ToCommand()
|
||||
{
|
||||
return new ResolveReferralCommand(Code);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class TrackReferralEventDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string RefCode { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(100)]
|
||||
public string? EventType { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? Source { get; set; }
|
||||
|
||||
public Guid? TargetUserId { get; set; }
|
||||
|
||||
public JsonElement? Metadata { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? TenantCode { get; set; }
|
||||
|
||||
public TrackReferralEventCommand ToCommand()
|
||||
{
|
||||
return new TrackReferralEventCommand(RefCode, EventType, Source, TargetUserId, Metadata);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class BindReferralDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100)]
|
||||
public string RefCode { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(100)]
|
||||
public string? Source { get; set; }
|
||||
|
||||
public JsonElement? Metadata { get; set; }
|
||||
|
||||
public BindReferralCommand ToCommand()
|
||||
{
|
||||
return new BindReferralCommand(RefCode, Source, Metadata);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ReferralQrcodeDto
|
||||
{
|
||||
[StringLength(500)]
|
||||
public string? Page { get; set; }
|
||||
|
||||
[StringLength(128)]
|
||||
public string? Scene { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? Provider { get; set; }
|
||||
|
||||
[StringLength(2048)]
|
||||
public string? QrcodeUrl { get; set; }
|
||||
|
||||
public JsonElement? Metadata { get; set; }
|
||||
|
||||
public ReferralQrcodeCommand ToCommand()
|
||||
{
|
||||
return new ReferralQrcodeCommand(Page, Scene, Provider, QrcodeUrl, Metadata);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user