Adds swagger and introduces repository-layer#91
Conversation
Phoscur
left a comment
There was a problem hiding this comment.
67 comments for 134 files :(
Lost concentration multiple times. Not reviewing this again.
| @@ -0,0 +1,4 @@ | |||
| export default class BuildBuildingRequest { | |||
There was a problem hiding this comment.
Simplify/Remove *Request interfaces?
There was a problem hiding this comment.
Because they are classes without methods - would be an actual good use for a typescript interface type. Also if these stay this short it might be ok to put them into one file together.
Don't remember what else I ment with "remove".
There was a problem hiding this comment.
Using interfaces with no defines methods and only properties is somewhat against the definition of an interface, isn't it? Would feel wrong to use interfaces instead of classes here.
There was a problem hiding this comment.
In the sense you might know interfaces from other languages, maybe.
But javascript is able to create data objects from pure json like it is the case here. Typescript can use interfaces to type those data objects without the need to instantiate them like you would do with class based objects. IMHO this is actually what typescript interfaces are mostly ment for and obviously this is quite different to other languages like Java.
| @@ -0,0 +1,6 @@ | |||
| import BuildOrderItem from "../common/BuildOrderItem"; | |||
|
|
|||
| export default class BuildDefenseRequest { | |||
There was a problem hiding this comment.
Simplify/Remove *Request interfaces?
| @@ -0,0 +1,6 @@ | |||
| import BuildOrderItem from "../common/BuildOrderItem"; | |||
|
|
|||
| export default class BuildShipsRequest { | |||
There was a problem hiding this comment.
Simplify/Remove *Request interfaces?
| } | ||
|
|
||
| if (error instanceof DuplicateRecordException || error.message.includes("Duplicate entry")) { | ||
| throw new Error(`There was an error while handling the request: ${error.message}`); |
There was a problem hiding this comment.
Please explain this error message construction
| // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa | ||
| import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, HttpStatusCodeLiteral, TsoaResponse } from 'tsoa'; | ||
| // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa | ||
| import { AuthRouter } from './../routes/AuthRouter'; |
There was a problem hiding this comment.
Might be able to put these into routes/index.ts ?
There was a problem hiding this comment.
Unfortunately not. This file is generated, you would need to copy/paste the content everytime your api changes
There was a problem hiding this comment.
Why wouldn't it be possible to generate imports from routes/index.ts?
src/routes/EventRouter.ts
Outdated
| return missionTypeID; | ||
| } | ||
| } | ||
| // import { Response, Router } from "express"; |
There was a problem hiding this comment.
Remove file - no outcommented code!
|
|
||
| // TODO: check, if event really is inQueue and/or returning | ||
| }); | ||
| // import * as chai from "chai"; |
| - stage: "Audit" | ||
| if: type = pull_request | ||
| script: audit-ci --low --report-type full | ||
| #- stage: "Audit" |
There was a problem hiding this comment.
I am not sure, github does auditions out-of-the-box so we could speed up our CI builds by removing the auditing
|
Kudos, SonarCloud Quality Gate passed!
|
This PR adds a swagger-file and provides a swagger-UI using tsoa (github repo). Moreover, a repository-layer is introduced.
This closes #27 and provides the tools to implement #53 and #54.
TODO for this PR: