This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
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.
* API_Design * Minor Fixes * Modification and Fixes
- Loading branch information
1 parent
78a9e42
commit 53d025b
Showing
9 changed files
with
189 additions
and
143 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { IsNotEmpty, IsString, IsOptional, IsEnum } from "class-validator"; | ||
import { validator } from "@ocular/utils"; | ||
import { OAuthService, OrganisationService } from "../../../../services"; | ||
import { AppNameDefinitions } from "@ocular/types"; | ||
import { EventBusService } from "../../../../services"; | ||
const { v4: uuidv4 } = require("uuid"); | ||
|
||
export default async (req, res) => { | ||
const validated = await validator(PostAppsReq, req.body); | ||
const eventBus_: EventBusService = req.scope.resolve("eventBusService"); | ||
const loggedInUser = req.scope.resolve("loggedInUser"); | ||
const organisationService: OrganisationService = req.scope.resolve( | ||
"organisationService" | ||
); | ||
|
||
const link_id = uuidv4(); | ||
|
||
const data = { | ||
link: validated.link, | ||
link_id, | ||
status: "processing", | ||
emit_event: true, | ||
}; | ||
|
||
const installed_apps = await organisationService.updateInstalledApp( | ||
validated.name, | ||
data | ||
); | ||
|
||
if (installed_apps) { | ||
res.status(200).json({ message: "Link saved successfully!" }); | ||
} else { | ||
res.status(500).json({ error: "Internal Server Error" }); | ||
} | ||
}; | ||
|
||
export class PostAppsReq { | ||
@IsNotEmpty() | ||
@IsEnum(AppNameDefinitions) | ||
name: AppNameDefinitions; | ||
|
||
@IsString() | ||
@IsNotEmpty() | ||
link: string; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.