chat implemented

This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 11:41:48 +03:00
parent 48eb2adcbd
commit 90604e48ae
101 changed files with 1493 additions and 116 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;
namespace HealthcareManager.API.Controllers;
namespace API.Controllers;
[Route("api/v1/[controller]")]
[ApiController]
+30 -5
View File
@@ -1,13 +1,38 @@
using Infrastructure.Services.MongoDB;
using Application.Endpoints;
using Application.Endpoints.Chats;
using Application.Services.Database;
using Application.Services.Database.MongoDB;
using Microsoft.AspNetCore.Mvc;
namespace HealthcareManager.API.Controllers;
namespace API.Controllers;
public class ChatController : BaseApiController
{
private readonly MongoDbService _mongoDbService;
private readonly IChatMongoDbService _chatMongoDbService;
private readonly IPatientRepository _patientRepository;
private readonly IDoctorRepository _doctorRepository;
public ChatController(MongoDbService mongoDbService)
public ChatController(IChatMongoDbService chatMongoDbService, IPatientRepository patientRepository,
IDoctorRepository doctorRepository)
{
_mongoDbService = mongoDbService;
_chatMongoDbService = chatMongoDbService;
_patientRepository = patientRepository;
_doctorRepository = doctorRepository;
}
[HttpPost("send_message")]
public async Task<ActionResult<BaseResponse>> SendMessage(SendMessageDto sendMessageDto)
{
var handler = new ChatHandler(_chatMongoDbService, _patientRepository, _doctorRepository);
var response = await handler.HandleSendMessage(sendMessageDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}
[HttpPost("get_conversation")]
public async Task<ActionResult<BaseResponse>> GetConversation(GetConversationDto getConversationDto)
{
var handler = new ChatHandler(_chatMongoDbService, _patientRepository, _doctorRepository);
var response = await handler.HandleGetConversation(getConversationDto).ConfigureAwait(false);
return StatusCode(response.StatusCode, response);
}
}
@@ -1,5 +1,4 @@
using Application.Endpoints;
using Application.Endpoints.MedicalHistories;
using Application.Endpoints.MedicalHistories.FileManagement;
using Application.Endpoints.MedicalHistories.ManageAuthorization;
using Application.Services.Database;