add a system controller with the current timestamp
This commit is contained in:
1 parent
13f5862654
commit
b7f6b079c3
2 files changed
+34
No files matched your search
@@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user