| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 3 | | |
| | | 4 | | namespace OzonDomains.Models; |
| | | 5 | | |
| | | 6 | | [Table("BitrixStockAutoSchedules")] |
| | | 7 | | public class BitrixStockAutoSchedule |
| | | 8 | | { |
| | | 9 | | [Key] |
| | 3 | 10 | | public int Id { get; set; } |
| | | 11 | | |
| | | 12 | | [Required] |
| | | 13 | | [MaxLength(256)] |
| | 6 | 14 | | public string Name { get; set; } = string.Empty; |
| | | 15 | | |
| | | 16 | | /// <summary>Clear — обнуление; Push — накат по связанным складам.</summary> |
| | | 17 | | [Required] |
| | | 18 | | [MaxLength(50)] |
| | 3 | 19 | | public string ActionType { get; set; } = BitrixStockAutoActionTypes.Clear; |
| | | 20 | | |
| | | 21 | | [Required] |
| | 3 | 22 | | public string FilterJson { get; set; } = "{}"; |
| | | 23 | | |
| | 0 | 24 | | public int OzonClientId { get; set; } |
| | | 25 | | |
| | | 26 | | [Required] |
| | | 27 | | [MaxLength(100)] |
| | 3 | 28 | | public string CronExpression { get; set; } = "0 3 * * *"; |
| | | 29 | | |
| | 6 | 30 | | public bool IsActive { get; set; } = true; |
| | | 31 | | |
| | 3 | 32 | | public int MaxItemsPerRun { get; set; } = 500; |
| | | 33 | | |
| | 0 | 34 | | public DateTime? LastRunAt { get; set; } |
| | | 35 | | |
| | 3 | 36 | | public DateTime? NextRunAt { get; set; } |
| | | 37 | | |
| | 3 | 38 | | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; |
| | | 39 | | |
| | 3 | 40 | | public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; |
| | | 41 | | |
| | | 42 | | [ForeignKey(nameof(OzonClientId))] |
| | 0 | 43 | | public virtual OzonClient? OzonClient { get; set; } |
| | | 44 | | |
| | 3 | 45 | | public virtual ICollection<BitrixStockAutoScheduleRun> Runs { get; set; } = new List<BitrixStockAutoScheduleRun>(); |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | public static class BitrixStockAutoActionTypes |
| | | 49 | | { |
| | | 50 | | public const string Clear = "Clear"; |
| | | 51 | | public const string Push = "Push"; |
| | | 52 | | } |
| | | 53 | | |
| | | 54 | | public static class BitrixStockAutoScheduleRunStatus |
| | | 55 | | { |
| | | 56 | | public const string Running = "Running"; |
| | | 57 | | public const string Success = "Success"; |
| | | 58 | | public const string Failed = "Failed"; |
| | | 59 | | public const string Skipped = "Skipped"; |
| | | 60 | | public const string PartialSuccess = "PartialSuccess"; |
| | | 61 | | } |