Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
b532eefa61
4 changed files with 12 additions and 5 deletions
|
|
@ -35,7 +35,8 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# คัดลอกไฟล์ .csproj และ restore dependencies
|
# คัดลอกไฟล์ .csproj และ restore dependencies
|
||||||
COPY *.csproj ./
|
# COPY *.csproj ./
|
||||||
|
COPY . ./
|
||||||
RUN dotnet restore
|
RUN dotnet restore
|
||||||
|
|
||||||
# คัดลอกไฟล์ทั้งหมดและ build
|
# คัดลอกไฟล์ทั้งหมดและ build
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ WriteToConsole("Consumer Start!");
|
||||||
var host = configuration["Rabbit:Host"] ?? "";
|
var host = configuration["Rabbit:Host"] ?? "";
|
||||||
var user = configuration["Rabbit:User"] ?? "";
|
var user = configuration["Rabbit:User"] ?? "";
|
||||||
var pass = configuration["Rabbit:Password"] ?? "";
|
var pass = configuration["Rabbit:Password"] ?? "";
|
||||||
|
var queue = configuration["Rabbit:Queue"] ?? "basic-queue";
|
||||||
|
|
||||||
// create connection
|
// create connection
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
|
|
@ -29,7 +30,8 @@ var factory = new ConnectionFactory()
|
||||||
using var connection = factory.CreateConnection();
|
using var connection = factory.CreateConnection();
|
||||||
using var channel = connection.CreateModel();
|
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);
|
var consumer = new EventingBasicConsumer(channel);
|
||||||
|
|
||||||
|
|
@ -59,7 +61,8 @@ consumer.Received += async (model, ea) =>
|
||||||
//WriteToConsole($"ตอบกลับจาก REST API: {JsonConvert.SerializeObject(item)}");
|
//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...");
|
//Console.WriteLine("\nPress 'Enter' to exit the process...");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Rabbit": {
|
"Rabbit": {
|
||||||
"Host": "192.168.1.40",
|
"Host": "192.168.1.40",
|
||||||
"User": "admin",
|
"User": "admin",
|
||||||
"Password": "Test123456"
|
"Password": "Test123456",
|
||||||
|
"Queue": "bma-checkin-queue"
|
||||||
},
|
},
|
||||||
"API": "https://localhost:7283/api/v1"
|
"API": "https://localhost:7283/api/v1"
|
||||||
}
|
}
|
||||||
|
|
@ -610,7 +610,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
if (data.CheckInFileName == "no-file") throw new Exception(GlobalMessages.NoFileToUpload);
|
if (data.CheckInFileName == "no-file") throw new Exception(GlobalMessages.NoFileToUpload);
|
||||||
var currentDate = data.CurrentDate ?? DateTime.Now;
|
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]))
|
using (var ms = new MemoryStream(data.CheckInFileBytes ?? new byte[0]))
|
||||||
{
|
{
|
||||||
await _minIOService.UploadFileAsync(fileName, ms);
|
await _minIOService.UploadFileAsync(fileName, ms);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue