diff --git a/BMA.EHR.CheckInConsumer/Dockerfile b/BMA.EHR.CheckInConsumer/Dockerfile index 7edc1b12..5bab7aad 100644 --- a/BMA.EHR.CheckInConsumer/Dockerfile +++ b/BMA.EHR.CheckInConsumer/Dockerfile @@ -35,7 +35,8 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src # คัดลอกไฟล์ .csproj และ restore dependencies -COPY *.csproj ./ +# COPY *.csproj ./ +COPY . ./ RUN dotnet restore # คัดลอกไฟล์ทั้งหมดและ build diff --git a/BMA.EHR.CheckInConsumer/Program.cs b/BMA.EHR.CheckInConsumer/Program.cs index 4d8323f4..1a5a68d1 100644 --- a/BMA.EHR.CheckInConsumer/Program.cs +++ b/BMA.EHR.CheckInConsumer/Program.cs @@ -16,6 +16,7 @@ WriteToConsole("Consumer Start!"); var host = configuration["Rabbit:Host"] ?? ""; var user = configuration["Rabbit:User"] ?? ""; var pass = configuration["Rabbit:Password"] ?? ""; +var queue = configuration["Rabbit:Queue"] ?? "basic-queue"; // create connection var factory = new ConnectionFactory() @@ -29,7 +30,8 @@ var factory = new ConnectionFactory() using var connection = factory.CreateConnection(); using var channel = connection.CreateModel(); -channel.QueueDeclare(queue: "bma-checkin-queue", durable: true, exclusive: false, autoDelete: false, arguments: null); +//channel.QueueDeclare(queue: "bma-checkin-queue", durable: true, exclusive: false, autoDelete: false, arguments: null); +channel.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: null); var consumer = new EventingBasicConsumer(channel); @@ -59,7 +61,8 @@ consumer.Received += async (model, ea) => //WriteToConsole($"ตอบกลับจาก REST API: {JsonConvert.SerializeObject(item)}"); }; -channel.BasicConsume(queue: "bma-checkin-queue", autoAck: true, consumer: consumer); +//channel.BasicConsume(queue: "bma-checkin-queue", autoAck: true, consumer: consumer); +channel.BasicConsume(queue: queue, autoAck: true, consumer: consumer); //Console.WriteLine("\nPress 'Enter' to exit the process..."); diff --git a/BMA.EHR.CheckInConsumer/appsettings.json b/BMA.EHR.CheckInConsumer/appsettings.json index 2cb51e69..b180f90c 100644 --- a/BMA.EHR.CheckInConsumer/appsettings.json +++ b/BMA.EHR.CheckInConsumer/appsettings.json @@ -2,7 +2,8 @@ "Rabbit": { "Host": "192.168.1.40", "User": "admin", - "Password": "Test123456" + "Password": "Test123456", + "Queue": "bma-checkin-queue" }, "API": "https://localhost:7283/api/v1" } \ No newline at end of file diff --git a/BMA.EHR.Leave/Controllers/LeaveController.cs b/BMA.EHR.Leave/Controllers/LeaveController.cs index f437ba26..08091074 100644 --- a/BMA.EHR.Leave/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveController.cs @@ -610,7 +610,9 @@ namespace BMA.EHR.Leave.Service.Controllers if (data.CheckInFileName == "no-file") throw new Exception(GlobalMessages.NoFileToUpload); var currentDate = data.CurrentDate ?? DateTime.Now; - var fileName = $"{_bucketName}/{userId}/{currentDate.ToString("dd-MM-yyyy")}/{data.CheckInFileName}"; + var check_status = data.CheckInId == null ? "check-in-picture" : "check-out-picture"; + + var fileName = $"{_bucketName}/{userId}/{currentDate.ToString("dd-MM-yyyy")}/{check_status}/{data.CheckInFileName}"; using (var ms = new MemoryStream(data.CheckInFileBytes ?? new byte[0])) { await _minIOService.UploadFileAsync(fileName, ms);