add a system controller with the current timestamp

This commit is contained in:
Sven Czarnian
2022-11-03 23:33:17 +01:00
parent 13f5862654
commit b7f6b079c3
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { SystemController } from './system.controller';
describe('SystemController', () => {
let controller: SystemController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [SystemController],
}).compile();
controller = module.get<SystemController>(SystemController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@@ -0,0 +1,16 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import { ApiResponse } from '@nestjs/swagger';
import { JwtGuard } from 'src/auth/guards/jwt.guard';
@Controller('system')
export class SystemController {
@UseGuards(JwtGuard)
@Get('/timestamp')
@ApiResponse({
description: 'The current ZULU timestamp of the system',
type: String,
})
async timestamp(): Promise<number> {
return new Date().getTime();
}
}