Skip to content

Commit

Permalink
feat: a cuppa (#3994)
Browse files Browse the repository at this point in the history
  • Loading branch information
YazeedLoonat authored Apr 3, 2024
1 parent a235916 commit c65dd2d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/src/controllers/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ export class AppController {
return await this.appService.healthCheck();
}

@Get('teapot')
@ApiOperation({
summary: 'Tip me over and pour me out',
operationId: 'teapot',
})
@ApiOkResponse({ type: SuccessDTO })
async teapot(): Promise<SuccessDTO> {
return await this.appService.teapot();
}

@Put('clearTempFiles')
@ApiOperation({
summary: 'Trigger the removal of CSVs job',
Expand Down
13 changes: 13 additions & 0 deletions api/src/services/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs';
import { join } from 'path';
import {
ImATeapotException,
Inject,
Injectable,
InternalServerErrorException,
Expand Down Expand Up @@ -111,4 +112,16 @@ export class AppService implements OnModuleInit {
});
}
}

// art pulled from: https://www.asciiart.eu/food-and-drinks/coffee-and-tea
async teapot(): Promise<SuccessDTO> {
throw new ImATeapotException(`
;,'
_o_ ;:;'
,-.'---\`.__ ;
((j\`=====',-'
\`-\ /
\`-=-' hjw
`);
}
}
14 changes: 14 additions & 0 deletions shared-helpers/src/types/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,20 @@ export class RootService {
axios(configs, resolve, reject)
})
}
/**
* Tip me over and pour me out
*/
teapot(options: IRequestOptions = {}): Promise<SuccessDTO> {
return new Promise((resolve, reject) => {
let url = basePath + "/teapot"

const configs: IRequestConfig = getConfigs("get", "application/json", url, options)

/** 适配ios13,get请求不允许带body */

axios(configs, resolve, reject)
})
}
/**
* Trigger the removal of CSVs job
*/
Expand Down

0 comments on commit c65dd2d

Please sign in to comment.