Merge branch 'main' of git.targo.ca:Targo/targo_backend into dev/matthieu/refactor
This commit is contained in:
commit
68f29b8842
|
|
@ -17,9 +17,7 @@ ENV AUTHENTIK_AUTH_URL="https://auth.targo.ca/application/o/authorize/"
|
|||
ENV AUTHENTIK_TOKEN_URL="https://auth.targo.ca/application/o/token/"
|
||||
ENV AUTHENTIK_USERINFO_URL="https://auth.targo.ca/application/o/userinfo/"
|
||||
|
||||
ENV TARGO_FRONTEND_URI_1="http://targo-frontend-nicolas:9000"
|
||||
ENV TARGO_FRONTEND_URI_2="http://targo-frontend-matthieu:9000"
|
||||
ENV TARGO_FRONTEND_URI_3="http://targo-frontend-lion:9000"
|
||||
ENV TARGO_FRONTEND_URI="http://10.100.251.2/"
|
||||
|
||||
ENV ATTACHMENTS_SERVER_ID="server"
|
||||
ENV ATTACHMENTS_ROOT=C:/
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ model AttachmentVariants {
|
|||
attachment_id Int
|
||||
attachment Attachments @relation("attachmentVariantAttachment",fields: [attachment_id], references: [id], onDelete: Cascade)
|
||||
variant String
|
||||
patch String
|
||||
path String
|
||||
bytes Int
|
||||
width Int?
|
||||
height Int?
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export class AuthController {
|
|||
@Get('/callback')
|
||||
@UseGuards(OIDCLoginGuard)
|
||||
loginCallback(@Req() req: Request, @Res() res: Response) {
|
||||
res.redirect('http://localhost:9000/#/login-success');
|
||||
res.redirect('http://10.100.251.2:9011/#/login-success');
|
||||
}
|
||||
|
||||
@Get('/me')
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ async function bootstrap() {
|
|||
|
||||
// Enable CORS
|
||||
app.enableCors({
|
||||
origin: [process.env.TARGO_FRONTEND_URI_1, process.env.TARGO_FRONTEND_URI_2, process.env.TARGO_FRONTEND_URI_3],
|
||||
origin: ['http://10.100.251.2:9011', 'http://10.100.251.2:9012', 'http://10.100.251.2:9013'],
|
||||
credentials: true,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// import { Injectable, Logger } from "@nestjs/common";
|
||||
// import { Cron } from "@nestjs/schedule";
|
||||
// import { TimesheetArchiveService } from "src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-archive.service";
|
||||
// import { ExpensesArchivalService } from "src/time-and-attendance/modules/expenses/services/expenses-archival.service";
|
||||
// import { ShiftsArchivalService } from "src/time-and-attendance/modules/time-tracker/shifts/services/shifts-archival.service";
|
||||
// import { TimesheetArchiveService } from "src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-archive.service";
|
||||
// import { Injectable, Logger } from "@nestjs/common";
|
||||
// import { Cron } from "@nestjs/schedule";
|
||||
|
||||
// @Injectable()
|
||||
// export class ArchivalService {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
import { ScheduleModule } from "@nestjs/schedule";
|
||||
import { PrismaService } from "src/prisma/prisma.service";
|
||||
import { ArchivalAttachmentService } from "./services/archival-attachment.service";
|
||||
import { ArchivalAttachmentService } from "src/modules/attachments/services/archival-attachment.service";
|
||||
import { GarbargeCollectorService } from "src/modules/attachments/services/garbage-collector.service";
|
||||
import { AttachmentsController } from "src/modules/attachments/controllers/attachments.controller";
|
||||
import { DiskStorageService } from "src/modules/attachments/services/disk-storage.service";
|
||||
// import { ScheduleModule } from "@nestjs/schedule";
|
||||
import { VariantsQueue } from "src/modules/attachments/services/variants.queue";
|
||||
import { Module } from "@nestjs/common";
|
||||
import { GarbargeCollectorService } from "./services/garbage-collector.service";
|
||||
|
||||
@Module({
|
||||
imports: [ScheduleModule.forRoot()],
|
||||
// imports: [ScheduleModule.forRoot()],
|
||||
controllers: [ AttachmentsController],
|
||||
providers: [
|
||||
PrismaService,
|
||||
ArchivalAttachmentService,
|
||||
GarbargeCollectorService,
|
||||
DiskStorageService,
|
||||
VariantsQueue,
|
||||
],
|
||||
exports: [
|
||||
ArchivalAttachmentService,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { promises as fsp } from 'node:fs';
|
||||
import { createWriteStream, statSync, existsSync } from 'node:fs';
|
||||
|
|
@ -7,6 +8,7 @@ import { ATT_TMP_DIR, resolveAttachmentsRoot } from 'src/config/attachment.confi
|
|||
|
||||
export type SaveResult = { sha256:string, storage_path:string, size:number};
|
||||
|
||||
@Injectable()
|
||||
export class DiskStorageService {
|
||||
private root = resolveAttachmentsRoot();
|
||||
|
||||
|
|
@ -38,7 +40,7 @@ export class DiskStorageService {
|
|||
|
||||
const hash = createHash('sha256');
|
||||
const tmpOut = createWriteStream(tmpPath);
|
||||
input.on('date', (chunk) => hash.update(chunk));
|
||||
input.on('data', (chunk) => hash.update(chunk));
|
||||
await pipeline(input, tmpOut); //await end of writing stream
|
||||
|
||||
const sha = hash.digest('hex');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { Injectable } from "@nestjs/common";
|
||||
import { Queue } from "bullmq";
|
||||
|
||||
@Injectable()
|
||||
export class VariantsQueue {
|
||||
private queue : Queue;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user