add a system controller with the current timestamp
This commit is contained in:
18
src/system/system.controller.spec.ts
Normal file
18
src/system/system.controller.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
16
src/system/system.controller.ts
Normal file
16
src/system/system.controller.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user