littleshop/LittleShop/Models/Bot.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

88 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LittleShop.Enums;
namespace LittleShop.Models;
public class Bot
{
public Guid Id { get; set; }
[Required]
[StringLength(256)]
public string BotKey { get; set; } = string.Empty;
[Required]
[StringLength(100)]
public string Name { get; set; } = string.Empty;
[StringLength(500)]
public string Description { get; set; } = string.Empty;
public BotType Type { get; set; }
public BotStatus Status { get; set; }
public string Settings { get; set; } = "{}"; // JSON storage
public DateTime CreatedAt { get; set; }
public DateTime? LastSeenAt { get; set; }
public DateTime? LastConfigSyncAt { get; set; }
public bool IsActive { get; set; }
[StringLength(50)]
public string Version { get; set; } = string.Empty;
[StringLength(50)]
public string IpAddress { get; set; } = string.Empty;
[StringLength(100)]
public string PlatformUsername { get; set; } = string.Empty;
[StringLength(200)]
public string PlatformDisplayName { get; set; } = string.Empty;
[StringLength(100)]
public string PlatformId { get; set; } = string.Empty;
[StringLength(50)]
public string PersonalityName { get; set; } = string.Empty;
// Remote Discovery Fields
/// <summary>
/// IP address or hostname of the remote TeleBot instance
/// </summary>
[StringLength(255)]
public string? RemoteAddress { get; set; }
/// <summary>
/// Port number for the remote TeleBot instance
/// </summary>
public int? RemotePort { get; set; }
/// <summary>
/// Timestamp of last successful discovery probe
/// </summary>
public DateTime? LastDiscoveryAt { get; set; }
/// <summary>
/// Discovery status: Local, Discovered, Initialized, Configured, Offline
/// </summary>
[StringLength(50)]
public string DiscoveryStatus { get; set; } = "Local";
/// <summary>
/// Instance ID returned by the remote TeleBot
/// </summary>
[StringLength(100)]
public string? RemoteInstanceId { get; set; }
// Navigation properties
public virtual ICollection<BotMetric> Metrics { get; set; } = new List<BotMetric>();
public virtual ICollection<BotSession> Sessions { get; set; } = new List<BotSession>();
}