feat: add student engagement endpoints

This commit is contained in:
xiong
2026-07-26 18:39:55 +08:00
parent 387b85342a
commit 89e1f2a4df
5 changed files with 547 additions and 0 deletions

View File

@@ -55,6 +55,71 @@ public sealed class ProfileController(
cancellationToken));
}
[HttpGet("notifications")]
[EndpointSummary("查询用户通知")]
[ProducesResponseType<ProfileNotificationList>(StatusCodes.Status200OK)]
public async Task<ActionResult<ProfileNotificationList>> Notifications(
[FromQuery] ProfileQueryDto query,
CancellationToken cancellationToken)
{
return Ok(await profileService.GetNotificationsAsync(
ResolveActor(),
new ProfileNotificationQuery(query.Status, query.Limit),
cancellationToken));
}
[HttpPost("notifications/status")]
[EndpointSummary("更新通知状态")]
[ProducesResponseType<ProfileNotificationList>(StatusCodes.Status200OK)]
public async Task<ActionResult<ProfileNotificationList>> UpdateNotificationStatus(
NotificationStatusDto request,
CancellationToken cancellationToken)
{
return Ok(await profileService.UpdateNotificationStatusAsync(
ResolveActor(),
request.ToCommand(),
cancellationToken));
}
[HttpGet("badges")]
[EndpointSummary("查询徽章列表")]
[ProducesResponseType<BadgeList>(StatusCodes.Status200OK)]
public async Task<ActionResult<BadgeList>> Badges(
[FromQuery] ProfileQueryDto query,
CancellationToken cancellationToken)
{
return Ok(await profileService.GetBadgesAsync(
ResolveActor(),
new BadgeQuery(query.IncludeLocked, query.Category, query.Limit),
cancellationToken));
}
[HttpGet("feedbacks")]
[EndpointSummary("查询反馈记录")]
[ProducesResponseType<IReadOnlyCollection<FeedbackItem>>(StatusCodes.Status200OK)]
public async Task<ActionResult<IReadOnlyCollection<FeedbackItem>>> Feedbacks(
[FromQuery] ProfileQueryDto query,
CancellationToken cancellationToken)
{
return Ok(await profileService.GetFeedbacksAsync(
ResolveActor(),
new FeedbackQuery(query.Status, query.Type, query.Limit),
cancellationToken));
}
[HttpPost("feedbacks")]
[EndpointSummary("提交意见反馈")]
[ProducesResponseType<FeedbackItem>(StatusCodes.Status200OK)]
public async Task<ActionResult<FeedbackItem>> SubmitFeedback(
SubmitFeedbackDto request,
CancellationToken cancellationToken)
{
return Ok(await profileService.SubmitFeedbackAsync(
ResolveActor(),
request.ToCommand(),
cancellationToken));
}
private ProfileActor ResolveActor()
{
if (currentTenant.TenantId is null || currentUser.UserId is null)