| | 1 | | using Syki.Back.Features.Teacher.AddExamGradeNote; |
| | 2 | | using Syki.Back.Features.Cross.FinishUserRegister; |
| | 3 | | using Syki.Back.Features.Cross.LinkOldNotifications; |
| | 4 | | using Syki.Back.Features.Cross.SendResetPasswordToken; |
| | 5 | | using Syki.Back.Features.Cross.CreatePendingUserRegister; |
| | 6 | |
|
| | 7 | | namespace Syki.Back.Tasks; |
| | 8 | |
|
| | 9 | | public class SykiTask |
| | 10 | | { |
| 2927 | 11 | | public Guid Id { get; set; } |
| 3902 | 12 | | public string Type { get; set; } |
| 2927 | 13 | | public string Data { get; set; } |
| 1954 | 14 | | public DateTime CreatedAt { get; set; } |
| 0 | 15 | | public DateTime? ProcessedAt { get; set; } |
| 0 | 16 | | public string? Error { get; set; } |
| 973 | 17 | | public Guid? ProcessorId { get; set; } |
| | 18 | |
|
| 1950 | 19 | | public SykiTask() { } |
| | 20 | |
|
| 981 | 21 | | public SykiTask(object data) |
| | 22 | | { |
| 981 | 23 | | Id = Guid.NewGuid(); |
| 981 | 24 | | Type = data.GetType().ToString(); |
| 981 | 25 | | Data = data.Serialize(); |
| 981 | 26 | | CreatedAt = DateTime.Now; |
| 981 | 27 | | } |
| | 28 | |
|
| | 29 | | public static SykiTask SendUserRegisterEmailConfirmation(string email) |
| | 30 | | { |
| 294 | 31 | | return new SykiTask(new SendUserRegisterEmailConfirmation { Email = email }); |
| | 32 | | } |
| | 33 | |
|
| | 34 | | public static SykiTask SendResetPasswordEmail(Guid userId) |
| | 35 | | { |
| 191 | 36 | | return new SykiTask(new SendResetPasswordEmail { UserId = userId }); |
| | 37 | | } |
| | 38 | |
|
| | 39 | | public static SykiTask SeedInstitutionData(Guid institutionId) |
| | 40 | | { |
| 279 | 41 | | return new SykiTask(new SeedInstitutionData { InstitutionId = institutionId }); |
| | 42 | | } |
| | 43 | |
|
| | 44 | | public static SykiTask LinkOldNotifications(Guid userId, Guid institutionId) |
| | 45 | | { |
| 177 | 46 | | return new SykiTask(new LinkOldNotifications { UserId = userId, InstitutionId = institutionId }); |
| | 47 | | } |
| | 48 | |
|
| | 49 | | public static SykiTask CreateNewExamGradeNoteNotification(Guid userId, Guid classId) |
| | 50 | | { |
| 40 | 51 | | return new SykiTask(new CreateNewExamGradeNoteNotification { UserId = userId, ClassId = classId }); |
| | 52 | | } |
| | 53 | | } |