Ignore:
Timestamp:
07/02/26 23:35:59 (3 days ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Parents:
3ae4bab
Message:

AI suggestions fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ChapterX.API/Controllers/AISuggestionsController.cs

    r3ae4bab ra6e33d1  
    55using Microsoft.AspNetCore.Mvc;
    66using Microsoft.Extensions.Logging;
     7using System.Linq;
    78
    89namespace ChapterX.API.Controllers
     
    3738            var response = await _mediator.Send(new GetRequest(id));
    3839            return Ok(response);
     40        }
     41
     42        [HttpGet("chapter/{chapterId:int}")]
     43        [AllowAnonymous]
     44        public async Task<ActionResult> GetByChapter(int chapterId)
     45        {
     46            _logger.LogInformation("Fetching AI suggestions for ChapterId: {ChapterId}", chapterId);
     47            var response = await _mediator.Send(new GetByChapterRequest(chapterId));
     48            var result = response.AISuggestions.Select(s => new
     49            {
     50                id = s.Id,
     51                originalText = s.OriginalText,
     52                suggestedText = s.SuggestedText,
     53                accepted = s.Accepted,
     54                createdAt = s.CreatedAt,
     55                appliedAt = s.AppliedAt,
     56                storyId = s.StoryId,
     57                suggestionTypes = s.SuggestionTypes.Select(t => t.SuggestionTypeValue),
     58            });
     59            return Ok(result);
    3960        }
    4061
Note: See TracChangeset for help on using the changeset viewer.