Implement backend API and database services in Docker setup
- Added a new `api` service for the NestJS backend, including health checks and dependencies on PostgreSQL, Redis, and MinIO. - Introduced PostgreSQL and Redis services with health checks and configurations for data persistence. - Added MinIO for S3-compatible object storage and a one-shot service to initialize required buckets. - Updated the Nginx configuration to proxy requests to the new backend API and MinIO storage. - Enhanced the Dockerfile to support the new API environment variables and configurations. - Updated the `package.json` and `package-lock.json` to include new dependencies for QR code generation and other utilities. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
17
backend/src/award-issuers/award-issuers.controller.ts
Normal file
17
backend/src/award-issuers/award-issuers.controller.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||
|
||||
import { HybridAuthGuard } from 'src/auth/guards/hybrid-auth.guard';
|
||||
import { AwardIssuersService } from './award-issuers.service';
|
||||
import { AwardIssuerDTO } from './dto/response/award-issuer.dto';
|
||||
|
||||
@Controller('award-issuers')
|
||||
@UseGuards(HybridAuthGuard)
|
||||
export class AwardIssuersController {
|
||||
constructor(private readonly issuersService: AwardIssuersService) {}
|
||||
|
||||
@Get()
|
||||
async findAll() {
|
||||
const issuers = await this.issuersService.findAll();
|
||||
return issuers.map((issuer) => new AwardIssuerDTO(issuer));
|
||||
}
|
||||
}
|
||||
12
backend/src/award-issuers/award-issuers.module.ts
Normal file
12
backend/src/award-issuers/award-issuers.module.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { AwardIssuer } from './entities/award-issuer.entity';
|
||||
import { AwardIssuersController } from './award-issuers.controller';
|
||||
import { AwardIssuersService } from './award-issuers.service';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([AwardIssuer])],
|
||||
controllers: [AwardIssuersController],
|
||||
providers: [AwardIssuersService],
|
||||
})
|
||||
export class AwardIssuersModule {}
|
||||
16
backend/src/award-issuers/award-issuers.service.ts
Normal file
16
backend/src/award-issuers/award-issuers.service.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { AwardIssuer } from './entities/award-issuer.entity';
|
||||
|
||||
@Injectable()
|
||||
export class AwardIssuersService {
|
||||
constructor(
|
||||
@InjectRepository(AwardIssuer)
|
||||
private issuersRepository: Repository<AwardIssuer>,
|
||||
) {}
|
||||
|
||||
findAll() {
|
||||
return this.issuersRepository.find();
|
||||
}
|
||||
}
|
||||
11
backend/src/award-issuers/dto/response/award-issuer.dto.ts
Normal file
11
backend/src/award-issuers/dto/response/award-issuer.dto.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { AwardIssuer } from 'src/award-issuers/entities/award-issuer.entity';
|
||||
|
||||
export class AwardIssuerDTO {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
constructor(awardIssuer: AwardIssuer) {
|
||||
this.id = awardIssuer.id;
|
||||
this.name = awardIssuer.name;
|
||||
}
|
||||
}
|
||||
27
backend/src/award-issuers/entities/award-issuer.entity.ts
Normal file
27
backend/src/award-issuers/entities/award-issuer.entity.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Award } from 'src/projects/entities/award.entity';
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
OneToMany,
|
||||
PrimaryColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity('award_issuers')
|
||||
export class AwardIssuer {
|
||||
@PrimaryColumn()
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@CreateDateColumn({ type: 'timestamptz' })
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn({ type: 'timestamptz' })
|
||||
updatedAt: Date;
|
||||
|
||||
@OneToMany(() => Award, (award) => award.issuer)
|
||||
awards: Award[];
|
||||
}
|
||||
Reference in New Issue
Block a user