Skip to content

Commit

Permalink
fix(fdr): attempt to fix git paths by adding res.send and removing …
Browse files Browse the repository at this point in the history
…any potential path conflicts (#1511)
  • Loading branch information
armandobelardo authored Sep 19, 2024
1 parent 6757b57 commit a6864cd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
12 changes: 6 additions & 6 deletions fern/apis/fdr/definition/git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ service:
listRepositories:
docs: Get all repositories.
method: GET
path: "/repository"
path: "/repository/list"
pagination:
offset: $request.page
results: $response.repositories
Expand Down Expand Up @@ -171,13 +171,13 @@ service:
upsertRepository:
docs: Update or create the specified repository.
method: PUT
path: /repository
path: /repository/upsert
request: FernRepository

deleteRepository:
docs: Delete specified repository.
method: DELETE
path: /repository/{repositoryOwner}/{repositoryName}
path: /repository/{repositoryOwner}/{repositoryName}/delete
path-parameters:
repositoryOwner: string
repositoryName: string
Expand All @@ -195,7 +195,7 @@ service:
listPullRequests:
docs: Get all pull requests.
method: GET
path: "/pull-request"
path: "/pull-request/list"
pagination:
offset: $request.page
results: $response.pullRequests
Expand Down Expand Up @@ -224,13 +224,13 @@ service:
upsertPullRequest:
docs: Update or create the specified pull request.
method: PUT
path: /pull-request
path: /pull-request/upsert
request: PullRequest

deletePullRequest:
docs: Delete specified pull request.
method: DELETE
path: /pull-request/{repositoryOwner}/{repositoryName}/{pullRequestNumber}
path: /pull-request/{repositoryOwner}/{repositoryName}/{pullRequestNumber}/delete
path-parameters:
repositoryOwner: string
repositoryName: string
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function getGeneratorsVersionsController(app: FdrApplication): VersionsSe
});

await app.dao.generatorVersions().upsertGeneratorRelease({ generatorRelease: req.body });
return res.send();
},
getGeneratorRelease: async (req, res) => {
const maybeRelease = await app.dao
Expand Down
12 changes: 8 additions & 4 deletions servers/fdr/src/controllers/git/getGitController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getGitController(app: FdrApplication): GitService {
throw new RepositoryNotFoundError(nameAndOwner);
}

res.send(maybeRepo);
return res.send(maybeRepo);
},
listRepositories: async (req, res) => {
await checkIsFernUser(req.headers.authorization);
Expand All @@ -36,12 +36,13 @@ export function getGitController(app: FdrApplication): GitService {
organizationId: req.query.organizationId,
});

res.send(repos);
return res.send(repos);
},
upsertRepository: async (req, res) => {
await checkIsFernUser(req.headers.authorization);

await app.dao.git().upsertRepository({ repository: req.body });
return res.send();
},
deleteRepository: async (req, res) => {
await checkIsFernUser(req.headers.authorization);
Expand All @@ -50,6 +51,7 @@ export function getGitController(app: FdrApplication): GitService {
repositoryName: req.params.repositoryName,
repositoryOwner: req.params.repositoryOwner,
});
return res.send();
},
getPullRequest: async (req, res) => {
await checkIsFernUser(req.headers.authorization);
Expand All @@ -64,7 +66,7 @@ export function getGitController(app: FdrApplication): GitService {
throw new PullRequestNotFoundError(nameAndOwner);
}

res.send(maybePull);
return res.send(maybePull);
},
listPullRequests: async (req, res) => {
await checkIsFernUser(req.headers.authorization);
Expand All @@ -77,12 +79,13 @@ export function getGitController(app: FdrApplication): GitService {
organizationId: req.query.organizationId,
});

res.send(repos);
return res.send(repos);
},
upsertPullRequest: async (req, res) => {
await checkIsFernUser(req.headers.authorization);

await app.dao.git().upsertPullRequest({ pullRequest: req.body });
return res.send();
},
deletePullRequest: async (req, res) => {
await checkIsFernUser(req.headers.authorization);
Expand All @@ -92,6 +95,7 @@ export function getGitController(app: FdrApplication): GitService {
repositoryOwner: req.params.repositoryOwner,
pullRequestNumber: req.params.pullRequestNumber,
});
return res.send();
},
});
}

0 comments on commit a6864cd

Please sign in to comment.