feat: добавил отправку уведомлений по почте
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 10s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 1m17s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 12s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 10s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 1m17s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 12s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
This commit is contained in:
@@ -152,6 +152,12 @@ public class EndpointAuthorizationTests : IClassFixture<ApiWebApplicationFactory
|
||||
yield return E("sync/status GET [Admin]", "GET", "api/v1/sync/status", "Admin", forbidden: ["Student", "Teacher"]);
|
||||
yield return E("sync/rooms POST [Admin]", "POST", "api/v1/sync/rooms", "Admin", forbidden: ["Student", "Teacher"]);
|
||||
yield return E("sync/employees POST [Admin]", "POST", "api/v1/sync/employees?fullname=test","Admin",forbidden: ["Student", "Teacher"]);
|
||||
|
||||
// ── Notifications — Admin only ─────────────────────────────────────────
|
||||
yield return E("notifications/send POST [Admin]", "POST", "api/v1/notifications/send", "Admin", forbidden: ["Student", "Teacher"],
|
||||
body: """{"channel":"email","recipient":"user@test.com","subject":"Test","body":"Hello"}""");
|
||||
yield return E("notifications/schedule POST [Admin]", "POST", "api/v1/notifications/schedule", "Admin", forbidden: ["Student", "Teacher"],
|
||||
body: $$"""{"channel":"email","recipient":"user@test.com","subject":"Test","body":"Hello","sendAt":"{{DateTimeOffset.UtcNow.AddMinutes(5):O}}"}""");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,6 +13,7 @@ using UniVerse.Application.DTOs.Courses;
|
||||
using UniVerse.Application.DTOs.Gamification;
|
||||
using UniVerse.Application.DTOs.Lectures;
|
||||
using UniVerse.Application.DTOs.Locations;
|
||||
using UniVerse.Application.DTOs.Notifications;
|
||||
using UniVerse.Application.DTOs.Reviews;
|
||||
using UniVerse.Application.DTOs.Sync;
|
||||
using UniVerse.Application.DTOs.Tags;
|
||||
@@ -96,6 +97,7 @@ public class ApiWebApplicationFactory : WebApplicationFactory<Program>
|
||||
ReplaceWithSubstitute<IScheduleSyncService>(services, CreateSyncServiceStub());
|
||||
ReplaceWithSubstitute<ILlmAnalysisService>(services, Substitute.For<ILlmAnalysisService>());
|
||||
ReplaceWithSubstitute<ILlmClient>(services, Substitute.For<ILlmClient>());
|
||||
ReplaceWithSubstitute<INotificationService>(services, CreateNotificationServiceStub());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,9 +117,9 @@ public class ApiWebApplicationFactory : WebApplicationFactory<Program>
|
||||
new AuthResponse("access_token", DateTime.UtcNow.AddHours(1),
|
||||
new UserAuthDto(1, "test@test.com", "Test User", UserRole.Student)),
|
||||
"refresh_token");
|
||||
stub.LoginWithMicrosoftAsync(Arg.Any<string>(), Arg.Any<string?>())
|
||||
stub.LoginWithMicrosoftAsync(Arg.Any<string>(), Arg.Any<string?>(), Arg.Any<string?>())
|
||||
.Returns(authResult);
|
||||
stub.DevLoginAsync(Arg.Any<string>(), Arg.Any<string?>(), Arg.Any<UserRole>())
|
||||
stub.DevLoginAsync(Arg.Any<string>(), Arg.Any<string?>(), Arg.Any<UserRole>(), Arg.Any<string?>())
|
||||
.Returns(authResult);
|
||||
stub.RefreshTokenAsync(Arg.Any<string>()).Returns(authResult);
|
||||
stub.GetCurrentUserAsync(Arg.Any<int>())
|
||||
@@ -125,6 +127,16 @@ public class ApiWebApplicationFactory : WebApplicationFactory<Program>
|
||||
return stub;
|
||||
}
|
||||
|
||||
private static INotificationService CreateNotificationServiceStub()
|
||||
{
|
||||
var stub = Substitute.For<INotificationService>();
|
||||
stub.SendAsync(Arg.Any<NotificationMessage>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Task.CompletedTask);
|
||||
stub.ScheduleAsync(Arg.Any<ScheduleNotificationRequest>(), Arg.Any<CancellationToken>())
|
||||
.Returns(new ScheduledNotificationResponse("test-job", DateTimeOffset.UtcNow.AddMinutes(5)));
|
||||
return stub;
|
||||
}
|
||||
|
||||
private static IUserService CreateUserServiceStub()
|
||||
{
|
||||
var stub = Substitute.For<IUserService>();
|
||||
|
||||
Reference in New Issue
Block a user