예제 #1
0
        public async Task <IActionResult> DeleteMoodRecord(string moodRecordId, CancellationToken token)
        {
            _logger.LogTrace($"{nameof(DeleteMoodRecord)} moodRecordId: {moodRecordId}");
            await _mediator.Send(MediatorRequestFactory.DeleteMoodRecordCommand(moodRecordId), token);

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> DeleteAllMoodRecords(CancellationToken token)
        {
            _logger.LogTrace($"{nameof(DeleteAllMoodRecords)}");
            await _mediator.Send(MediatorRequestFactory.DeleteAllMoodRecordsCommand(), token);

            return(NoContent());
        }
예제 #3
0
        public async Task <IActionResult> UpdateMoodRecord(
            [FromBody] UpdateMoodRecordRequest request,
            CancellationToken token)
        {
            _logger.LogTrace($"{nameof(UpdateMoodRecord)} request body: {request}");
            var result = await _mediator.Send(MediatorRequestFactory.UpdateMoodRecordCommand(request), token);

            return(Ok(result));
        }
예제 #4
0
        public async Task <IActionResult> GetLatestCreatedMoodRecords(int numberOfMoodRecords, CancellationToken token)
        {
            _logger.LogTrace(
                $"{nameof(GetLatestCreatedMoodRecords)} numberOfMoodRecords: {numberOfMoodRecords.ToString()}");

            var result = await _mediator.Send(
                MediatorRequestFactory.GetLatestCreatedMoodRecordsQuery(numberOfMoodRecords),
                token);

            return(Ok(result));
        }
예제 #5
0
        public async Task <IActionResult> GetMoodRecordsByMoodRecordId(
            [FromBody] GetMoodRecordByMoodRecordIdRequest request,
            CancellationToken token)
        {
            _logger.LogTrace(
                $"{nameof(GetMoodRecordsByMoodRecordId)} request body: {JsonSerializer.Serialize(request)}");
            var result = await _mediator.Send(
                MediatorRequestFactory.GetMoodRecordByMoodRecordIdQuery(request),
                token);

            return(Ok(result));
        }