mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-26 17:57:44 +02:00
Merge branch 'dev-1' into dev
This commit is contained in:
commit
d41d060bb3
1770 changed files with 168028 additions and 31031 deletions
|
|
@ -0,0 +1,22 @@
|
|||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { ThemeService } from './theme.service';
|
||||
|
||||
@Controller('themes')
|
||||
export class ThemeController {
|
||||
constructor(private readonly themeService: ThemeService) {}
|
||||
|
||||
@Get()
|
||||
async findAll() {
|
||||
return this.themeService.findAll();
|
||||
}
|
||||
|
||||
@Get('default')
|
||||
async findDefault() {
|
||||
return this.themeService.findDefault();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(@Param('id') id: string) {
|
||||
return this.themeService.findOne(id);
|
||||
}
|
||||
}
|
||||
10
apps-archived/presi/apps/backend/src/theme/theme.module.ts
Normal file
10
apps-archived/presi/apps/backend/src/theme/theme.module.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ThemeController } from './theme.controller';
|
||||
import { ThemeService } from './theme.service';
|
||||
|
||||
@Module({
|
||||
controllers: [ThemeController],
|
||||
providers: [ThemeService],
|
||||
exports: [ThemeService],
|
||||
})
|
||||
export class ThemeModule {}
|
||||
27
apps-archived/presi/apps/backend/src/theme/theme.service.ts
Normal file
27
apps-archived/presi/apps/backend/src/theme/theme.service.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import { DATABASE_CONNECTION } from '../db/database.module';
|
||||
import { Database } from '../db/connection';
|
||||
import { themes } from '../db/schema';
|
||||
|
||||
@Injectable()
|
||||
export class ThemeService {
|
||||
constructor(
|
||||
@Inject(DATABASE_CONNECTION)
|
||||
private readonly db: Database
|
||||
) {}
|
||||
|
||||
async findAll() {
|
||||
return this.db.select().from(themes);
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
const result = await this.db.select().from(themes).where(eq(themes.id, id));
|
||||
return result[0] || null;
|
||||
}
|
||||
|
||||
async findDefault() {
|
||||
const result = await this.db.select().from(themes).where(eq(themes.isDefault, true));
|
||||
return result[0] || null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue