littleshop/LittleShop/DTOs/BotDto.cs
SysAdmin 521bff2c7d
All checks were successful
Build and Deploy LittleShop / Deploy to Production VPS (Manual Only) (push) Has been skipped
Build and Deploy LittleShop / Deploy to Pre-Production (CT109) (push) Successful in 1m0s
feat: Add Remote TeleBot Discovery & Configuration
- Add discovery API endpoints to TeleBot (probe, initialize, configure, status)
- Add LivenessService for LittleShop connectivity monitoring with 5min shutdown
- Add BotDiscoveryService to LittleShop for remote bot management
- Add Admin UI: DiscoverRemote wizard, RepushConfig page, status badges
- Add remote discovery fields to Bot model (RemoteAddress, RemotePort, etc.)
- Add CheckRemoteStatus and RepushConfig controller actions
- Update Index/Details views to show remote bot indicators
- Shared secret authentication for discovery, BotKey for post-init

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 13:41:36 +00:00

145 lines
4.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LittleShop.Enums;
namespace LittleShop.DTOs;
public class BotDto
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public BotType Type { get; set; }
public BotStatus Status { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? LastSeenAt { get; set; }
public DateTime? LastConfigSyncAt { get; set; }
public bool IsActive { get; set; }
public string Version { get; set; } = string.Empty;
public string IpAddress { get; set; } = string.Empty;
public string PlatformUsername { get; set; } = string.Empty;
public string PlatformDisplayName { get; set; } = string.Empty;
public string PlatformId { get; set; } = string.Empty;
public string PersonalityName { get; set; } = string.Empty;
public Dictionary<string, object> Settings { get; set; } = new();
// Remote Discovery Fields
public string? RemoteAddress { get; set; }
public int? RemotePort { get; set; }
public DateTime? LastDiscoveryAt { get; set; }
public string DiscoveryStatus { get; set; } = "Local";
public string? RemoteInstanceId { get; set; }
/// <summary>
/// Indicates if this is a remotely discovered bot
/// </summary>
public bool IsRemote => !string.IsNullOrEmpty(RemoteAddress);
/// <summary>
/// Full remote endpoint URL
/// </summary>
public string? RemoteEndpoint => IsRemote ? $"{RemoteAddress}:{RemotePort}" : null;
// Metrics summary
public int TotalSessions { get; set; }
public int ActiveSessions { get; set; }
public decimal TotalRevenue { get; set; }
public int TotalOrders { get; set; }
}
public class BotRegistrationDto
{
[Required]
[StringLength(100)]
public string Name { get; set; } = string.Empty;
[StringLength(500)]
public string Description { get; set; } = string.Empty;
public BotType Type { get; set; }
[StringLength(50)]
public string Version { get; set; } = string.Empty;
[StringLength(50)]
public string PersonalityName { get; set; } = string.Empty;
public Dictionary<string, object> InitialSettings { get; set; } = new();
}
public class BotRegistrationResponseDto
{
public Guid BotId { get; set; }
public string BotKey { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public Dictionary<string, object> Settings { get; set; } = new();
}
public class BotAuthenticateDto
{
public string BotKey { get; set; } = string.Empty;
}
public class BotSettingsDto
{
public Dictionary<string, object> Telegram { get; set; } = new();
public Dictionary<string, object> Privacy { get; set; } = new();
public Dictionary<string, object> Features { get; set; } = new();
public Dictionary<string, object> Redis { get; set; } = new();
public List<string> Cryptocurrencies { get; set; } = new();
}
public class UpdateBotSettingsDto
{
public Dictionary<string, object> Settings { get; set; } = new();
}
public class BotHeartbeatDto
{
public string Version { get; set; } = string.Empty;
public string IpAddress { get; set; } = string.Empty;
public int ActiveSessions { get; set; }
public Dictionary<string, object> Status { get; set; } = new();
}
public class UpdatePlatformInfoDto
{
public string PlatformUsername { get; set; } = string.Empty;
public string PlatformDisplayName { get; set; } = string.Empty;
public string PlatformId { get; set; } = string.Empty;
}
public class BotWizardDto
{
[Required(ErrorMessage = "Bot name is required")]
[StringLength(50)]
public string BotName { get; set; } = string.Empty;
[Required(ErrorMessage = "Bot username is required")]
[StringLength(100)]
public string BotUsername { get; set; } = string.Empty;
[StringLength(500)]
public string Description { get; set; } = string.Empty;
[StringLength(50)]
public string PersonalityName { get; set; } = string.Empty;
public string BotToken { get; set; } = string.Empty;
}
public class UpdateBotWalletsDto
{
public Dictionary<string, string> Wallets { get; set; } = new();
}
public class BotWalletEntry
{
[Required]
public string Currency { get; set; } = string.Empty;
[Required]
[StringLength(500)]
public string Address { get; set; } = string.Empty;
}