-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): reworked everything to use the new systems, endpoints,…
… parsing and deleted unused stuff
- Loading branch information
1 parent
9de603d
commit 5ef7647
Showing
486 changed files
with
68,421 additions
and
13,288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ data/ | |
db/ | ||
logs/ | ||
dist/ | ||
tmp/ | ||
.eslintcache | ||
*.log | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+13.6 KB
.yarn/cache/mongodb-connection-string-url-npm-3.0.0-a7f39bb823-9d48853773.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"dynamicImport": true | ||
}, | ||
"target": "es2021", | ||
"keepClassNames": true, | ||
"loose": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["src/*"] | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
}, | ||
"sourceMaps": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
import { StatusCodes } from 'http-status-codes'; | ||
import { DefaultContext } from 'koa'; | ||
import HttpError from "../http/errors/http"; | ||
import NotFound from "../http/errors/notFound"; | ||
|
||
import { getFromContainer } from '@/infra/container/container'; | ||
import { Logger } from '@/infra/logger/logger'; | ||
|
||
import HttpError from '../http/errors/http'; | ||
import NotFound from '../http/errors/notFound'; | ||
|
||
export default () => async (ctx: DefaultContext, next: () => Promise<any>) => { | ||
try { | ||
await next(); | ||
await next(); | ||
|
||
if (!ctx.body | ||
&& (!ctx.status | ||
|| ctx.status === StatusCodes.NOT_FOUND | ||
|| ctx.status === StatusCodes.METHOD_NOT_ALLOWED)) { | ||
throw new NotFound(); | ||
} | ||
if ( | ||
!ctx.body && | ||
(!ctx.status || | ||
ctx.status === StatusCodes.NOT_FOUND || | ||
ctx.status === StatusCodes.METHOD_NOT_ALLOWED) | ||
) { | ||
throw new NotFound(); | ||
} | ||
} catch (err) { | ||
if (err instanceof HttpError) { | ||
ctx.error({ | ||
statusCode: err.statusCode, | ||
code: err.code, | ||
message: err.message, | ||
}); | ||
} else { | ||
ctx.error({ | ||
status: StatusCodes.INTERNAL_SERVER_ERROR, | ||
code: 'UNKNOWN_ERROR', | ||
message: 'The server encountered an unknown error.', | ||
}); | ||
} | ||
ctx.app.emit('error', err, ctx); | ||
getFromContainer(Logger).debug(`http error`, err); | ||
if (err instanceof HttpError) { | ||
ctx.error({ | ||
statusCode: err.statusCode, | ||
code: err.code, | ||
message: err.message, | ||
}); | ||
} else { | ||
ctx.error({ | ||
status: StatusCodes.INTERNAL_SERVER_ERROR, | ||
code: 'UNKNOWN_ERROR', | ||
message: `The server encountered an unknown error: ${err.message}`, | ||
}); | ||
} | ||
ctx.app.emit('error', err, ctx); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.