21 lines
660 B
TypeScript
21 lines
660 B
TypeScript
import { Controller, Get, Put, Body } from '@nestjs/common';
|
|
import { NightModeService } from './night-mode.service';
|
|
import { NightModeDto } from './dto/night-mode.dto';
|
|
import { CurrentUser } from '../common/decorators/current-user.decorator';
|
|
import { User } from '../users/entities/user.entity';
|
|
|
|
@Controller('user/night-mode')
|
|
export class NightModeController {
|
|
constructor(private nightModeService: NightModeService) {}
|
|
|
|
@Get()
|
|
get(@CurrentUser() user: User) {
|
|
return this.nightModeService.get(user.id);
|
|
}
|
|
|
|
@Put()
|
|
update(@CurrentUser() user: User, @Body() dto: NightModeDto) {
|
|
return this.nightModeService.update(user.id, dto);
|
|
}
|
|
}
|