-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): fix API for public consumption (#30)
* feat(api): fix API for public consumption
- Loading branch information
1 parent
f2759fa
commit ae0ae2f
Showing
60 changed files
with
554 additions
and
304 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
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"extends": ["typestrict", "tslint:latest", "tslint-config-prettier"], | ||
"rules": { | ||
"no-string-throw": false, | ||
"class-name": false, | ||
"interface-over-type-literal": false, | ||
"interface-name": [false], | ||
"max-classes-per-file": false, | ||
"member-access": [false], | ||
"no-submodule-imports": false, | ||
"no-unused-variable": false, | ||
"no-implicit-dependencies": false, | ||
"no-var-keyword": false, | ||
"no-floating-promises": true, | ||
"no-console": false | ||
}, | ||
"linterOptions": { | ||
"exclude": ["node_modules/**/*", "generated/*", "src/migration/*"] | ||
} | ||
} |
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,17 +1,32 @@ | ||
import 'reflect-metadata'; | ||
|
||
import { Container } from 'typedi'; | ||
import { App, AppOptions } from '../../../src/'; | ||
|
||
// import { User } from './modules/user/user.entity'; | ||
import { App, BaseContext } from '../../../src/'; | ||
|
||
export function getApp(appOptions: Partial<AppOptions> = {}, dbOptions: any = {}) { | ||
return new App( | ||
{ | ||
container: Container, | ||
warthogImportPath: '../../../src', // Path written in generated classes | ||
...appOptions | ||
// import { User } from './modules/user/user.model'; | ||
|
||
interface Context extends BaseContext { | ||
user: { | ||
email: string; | ||
id: string; | ||
permissions: string; | ||
}; | ||
} | ||
|
||
export function getApp() { | ||
return new App<Context>({ | ||
container: Container, | ||
// Inject a fake user. In a real app you'd parse a JWT to add the user | ||
context: request => { | ||
return { | ||
user: { | ||
email: 'admin@test.com', | ||
id: 'abc12345', | ||
permissions: ['user:read', 'user:update', 'user:create', 'user:delete', 'photo:delete'] | ||
} | ||
}; | ||
}, | ||
dbOptions | ||
); | ||
warthogImportPath: '../../../src' // Path written in generated classes | ||
}); | ||
} |
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
File renamed without changes.
Oops, something went wrong.