fix err
This commit is contained in:
parent
dc920d5e0c
commit
25fe0ac9d2
2 changed files with 13 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ export default class {
|
||||||
}
|
}
|
||||||
|
|
||||||
async AuthApp(req: Types.AuthAppRequest): Promise<Types.AuthApp> {
|
async AuthApp(req: Types.AuthAppRequest): Promise<Types.AuthApp> {
|
||||||
const app = await this.storage.applicationStorage.GetApplication(req.name)
|
const app = await this.storage.applicationStorage.GetApplicationByName(req.name)
|
||||||
return {
|
return {
|
||||||
app: {
|
app: {
|
||||||
id: app.app_id,
|
id: app.app_id,
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,18 @@ export default class {
|
||||||
return repo.save(newApplication)
|
return repo.save(newApplication)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async GetApplicationByName(name: string, entityManager = this.DB) {
|
||||||
|
const found = await entityManager.getRepository(Application).findOne({
|
||||||
|
where: {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!found) {
|
||||||
|
throw new Error(`application ${name} not found`)
|
||||||
|
}
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
async GetApplication(appId: string, entityManager = this.DB): Promise<Application> {
|
async GetApplication(appId: string, entityManager = this.DB): Promise<Application> {
|
||||||
const found = await entityManager.getRepository(Application).findOne({
|
const found = await entityManager.getRepository(Application).findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue