Добавил слой Application

This commit is contained in:
2026-04-28 15:52:32 +03:00
parent df0e30a1ae
commit d64447f0be
25 changed files with 595 additions and 0 deletions
@@ -0,0 +1,12 @@
using UniVerse.Application.DTOs.Achievements;
namespace UniVerse.Application.Interfaces;
public interface IAchievementService
{
Task<List<AchievementDto>> GetAllAsync();
Task<AchievementDto> GetByIdAsync(int id);
Task<AchievementDto> CreateAsync(CreateAchievementRequest request);
Task<AchievementDto> UpdateAsync(int id, UpdateAchievementRequest request);
Task DeleteAsync(int id);
}
@@ -0,0 +1,13 @@
using UniVerse.Application.DTOs.Auth;
using UniVerse.Application.DTOs.Users;
namespace UniVerse.Application.Interfaces;
public interface IAuthService
{
Task<AuthResponse> LoginWithMicrosoftAsync(string authorizationCode);
Task<AuthResponse> DevLoginAsync(string email, string? displayName, Domain.Enums.UserRole role);
Task<AuthResponse> RefreshTokenAsync(string refreshToken);
Task RevokeRefreshTokenAsync(string refreshToken);
Task<UserDto> GetCurrentUserAsync(int userId);
}
@@ -0,0 +1,15 @@
using UniVerse.Application.DTOs.Common;
using UniVerse.Application.DTOs.Courses;
namespace UniVerse.Application.Interfaces;
public interface ICourseService
{
Task<PagedResult<CourseDto>> GetAllAsync(CourseFilterRequest filter);
Task<CourseDto> GetByIdAsync(int id);
Task<CourseDto> CreateAsync(CreateCourseRequest request);
Task<CourseDto> UpdateAsync(int id, UpdateCourseRequest request);
Task DeleteAsync(int id);
Task AddTagAsync(int courseId, int tagId);
Task RemoveTagAsync(int courseId, int tagId);
}
@@ -0,0 +1,16 @@
using UniVerse.Application.DTOs.Achievements;
using UniVerse.Application.DTOs.Common;
using UniVerse.Application.DTOs.Gamification;
using UniVerse.Domain.Enums;
namespace UniVerse.Application.Interfaces;
public interface IGamificationService
{
Task AwardCoinsAsync(int userId, int amount, CoinTransactionType type,
int? reviewId = null, int? achievementId = null, string? description = null);
Task CheckAndAwardAchievementsAsync(int userId);
int CalculateLevel(int xp);
Task<List<UserAchievementDto>> GetUserAchievementsAsync(int userId);
Task<PagedResult<CoinTransactionDto>> GetTransactionsAsync(int userId, PaginationRequest pagination);
}
@@ -0,0 +1,17 @@
using UniVerse.Application.DTOs.Common;
using UniVerse.Application.DTOs.Lectures;
namespace UniVerse.Application.Interfaces;
public interface ILectureService
{
Task<PagedResult<LectureDto>> GetAllAsync(LectureFilterRequest filter);
Task<LectureDetailDto> GetByIdAsync(int id, int? currentUserId = null);
Task<LectureDto> CreateAsync(CreateLectureRequest request);
Task<LectureDto> UpdateAsync(int id, UpdateLectureRequest request);
Task DeleteAsync(int id);
Task EnrollAsync(int lectureId, int userId);
Task UnenrollAsync(int lectureId, int userId);
Task MarkAttendanceAsync(int lectureId, int userId, bool attended);
Task<PagedResult<EnrollmentDto>> GetEnrollmentsAsync(int lectureId, PaginationRequest pagination);
}
@@ -0,0 +1,7 @@
namespace UniVerse.Application.Interfaces;
public interface ILlmAnalysisService
{
Task AnalyzeReviewAsync(int reviewId);
Task ProcessPendingReviewsAsync();
}
@@ -0,0 +1,13 @@
namespace UniVerse.Application.Interfaces;
public record LlmReviewAnalysis(
double QualityScore,
string Sentiment,
string[] Tags,
bool IsInformative
);
public interface ILlmClient
{
Task<LlmReviewAnalysis> AnalyzeReviewAsync(string reviewText, string lectureContext);
}
@@ -0,0 +1,12 @@
using UniVerse.Application.DTOs.Locations;
namespace UniVerse.Application.Interfaces;
public interface ILocationService
{
Task<List<LocationDto>> GetAllAsync();
Task<LocationDto> GetByIdAsync(int id);
Task<LocationDto> CreateAsync(CreateLocationRequest request);
Task<LocationDto> UpdateAsync(int id, UpdateLocationRequest request);
Task DeleteAsync(int id);
}
@@ -0,0 +1,16 @@
using UniVerse.Application.DTOs.Common;
using UniVerse.Application.DTOs.Reviews;
namespace UniVerse.Application.Interfaces;
public interface IReviewService
{
Task<ReviewDto> CreateAsync(int userId, CreateReviewRequest request);
Task<ReviewDto> GetByIdAsync(int id);
Task<ReviewDto> UpdateAsync(int id, int userId, UpdateReviewRequest request);
Task DeleteAsync(int id, int userId, bool isAdmin = false);
Task<PagedResult<ReviewDto>> GetByLectureAsync(int lectureId, PaginationRequest pagination);
Task<PagedResult<ReviewDto>> GetByUserAsync(int userId, PaginationRequest pagination);
Task<PagedResult<ReviewDto>> GetPendingAsync(PaginationRequest pagination);
Task ReanalyzeAsync(int id);
}
@@ -0,0 +1,25 @@
using UniVerse.Application.DTOs.Sync;
namespace UniVerse.Application.Interfaces;
public interface IScheduleSyncService
{
Task<SyncResultDto> SyncScheduleAsync(SyncScheduleRequest request);
Task<SyncResultDto> SyncRoomsAsync();
Task<List<EmployeeDto>> SearchEmployeesAsync(string fullname);
Task<SyncStatusDto> GetLastSyncStatusAsync();
}
public interface IModeusApiClient
{
Task<ModeusEventsResponse> SearchEventsAsync(SyncScheduleRequest request);
Task<ModeusRoomsResponse> SearchRoomsAsync();
Task<List<ModeusEmployee>> SearchEmployeeAsync(string fullname);
}
// Modeus API response models
public record ModeusEvent(string Id, string Name, DateTime StartsAt, DateTime EndsAt, string? RoomId, string? TeacherId, string? TypeId);
public record ModeusEventsResponse(List<ModeusEvent> Events);
public record ModeusRoom(string Id, string Name, string? Building);
public record ModeusRoomsResponse(List<ModeusRoom> Rooms);
public record ModeusEmployee(string? Id, string FullName, string? Department);
@@ -0,0 +1,15 @@
using UniVerse.Application.DTOs.Common;
using UniVerse.Application.DTOs.Tags;
using UniVerse.Domain.Enums;
namespace UniVerse.Application.Interfaces;
public interface ITagService
{
Task<List<TagDto>> GetAllAsync(TagType? type = null, int? parentId = null);
Task<TagDto> GetByIdAsync(int id);
Task<TagDto> CreateAsync(CreateTagRequest request);
Task<TagDto> UpdateAsync(int id, UpdateTagRequest request);
Task DeleteAsync(int id);
Task<List<TagTreeDto>> GetTreeAsync();
}
@@ -0,0 +1,15 @@
using UniVerse.Application.DTOs.Common;
using UniVerse.Application.DTOs.Users;
using UniVerse.Domain.Enums;
namespace UniVerse.Application.Interfaces;
public interface IUserService
{
Task<UserDto> GetByIdAsync(int id);
Task<UserDto> UpdateProfileAsync(int id, UpdateUserRequest request);
Task<UserStatsDto> GetStatsAsync(int id);
Task<PagedResult<UserDto>> GetAllAsync(UserFilterRequest filter);
Task SetRoleAsync(int id, UserRole role);
Task SetActiveAsync(int id, bool isActive);
}