chat implemented
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user