Skip to content

Commit 97a319c

Browse files
committed
feat: add status endpoint
1 parent 54319b1 commit 97a319c

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

.changeset/popular-shrimps-cry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@quassel/backend": patch
3+
---
4+
5+
Add status endpoint

apps/backend/src/system/health/health.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class HealthController {
1212
@Get()
1313
@HealthCheck()
1414
@Public()
15-
check() {
15+
get() {
1616
return this.health.check([() => this.database.pingCheck("database")]);
1717
}
1818
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Test, TestingModule } from "@nestjs/testing";
2+
import { StatusController } from "./status.controller";
3+
4+
describe("StatusController", () => {
5+
let controller: StatusController;
6+
7+
beforeEach(async () => {
8+
const module: TestingModule = await Test.createTestingModule({
9+
controllers: [StatusController],
10+
}).compile();
11+
12+
controller = module.get<StatusController>(StatusController);
13+
});
14+
15+
it("should be defined", () => {
16+
expect(controller).toBeDefined();
17+
});
18+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Controller, Get } from "@nestjs/common";
2+
import { Public } from "../session/public.decorator";
3+
import { version } from "../../../package.json";
4+
5+
@Controller("status")
6+
export class StatusController {
7+
@Get()
8+
@Public()
9+
get() {
10+
return { version };
11+
}
12+
}

apps/backend/src/system/system.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import { SessionGuard } from "./session/session.guard";
1010
import { RolesGuard } from "./users/roles.guard";
1111
import { HealthController } from "./health/health.controller";
1212
import { TerminusModule } from "@nestjs/terminus";
13+
import { StatusController } from "./status/status.controller";
1314

1415
@Module({
1516
imports: [MikroOrmModule.forFeature([User]), TerminusModule],
16-
controllers: [UsersController, SessionController, HealthController],
17+
controllers: [UsersController, SessionController, HealthController, StatusController],
1718
providers: [UsersService, SessionService, { provide: APP_GUARD, useClass: SessionGuard }, { provide: APP_GUARD, useClass: RolesGuard }],
1819
})
1920
export class SystemModule {}

0 commit comments

Comments
 (0)