Skip to content

Commit

Permalink
chore: fix 'agreements' routes
Browse files Browse the repository at this point in the history
  • Loading branch information
trulshj committed Jan 6, 2025
1 parent a4783e2 commit 1bd1278
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions backend/Api/Agreements/AgreementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AgreementController(


[HttpGet]
[Route("get/{agreementId:int}")]
[Route("{agreementId:int}")]
public async Task<ActionResult<AgreementReadModel>> GetAgreement([FromRoute] string orgUrlKey,
[FromRoute] int agreementId, CancellationToken ct)
{
Expand Down Expand Up @@ -52,7 +52,7 @@ public async Task<ActionResult<AgreementReadModel>> GetAgreement([FromRoute] str
}

[HttpGet]
[Route("get/engagement/{engagementId:int}")]
[Route("engagement/{engagementId:int}")]
public async Task<ActionResult<List<AgreementReadModel>>> GetAgreementsByEngagement([FromRoute] string orgUrlKey,
[FromRoute] int engagementId, CancellationToken ct)
{
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task<ActionResult<List<AgreementReadModel>>> GetAgreementsByEngagem
}

[HttpGet]
[Route("get/customer/{customerId:int}")]
[Route("customer/{customerId:int}")]
public async Task<ActionResult<List<AgreementReadModel>>> GetAgreementsByCustomer([FromRoute] string orgUrlKey,
[FromRoute] int customerId, CancellationToken ct)
{
Expand Down Expand Up @@ -108,7 +108,6 @@ public async Task<ActionResult<List<AgreementReadModel>>> GetAgreementsByCustome
}

[HttpPost]
[Route("create")]
public async Task<ActionResult<AgreementReadModel>> Post([FromRoute] string orgUrlKey,
[FromBody] AgreementWriteModel body, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -190,7 +189,7 @@ public async Task<ActionResult<AgreementReadModel>> Post([FromRoute] string orgU
}

[HttpPut]
[Route("update/{agreementId:int}")]
[Route("{agreementId:int}")]
public async Task<ActionResult<AgreementReadModel>> Put([FromRoute] string orgUrlKey,
[FromRoute] int agreementId, [FromBody] AgreementWriteModel body, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -283,7 +282,7 @@ public async Task<ActionResult<AgreementReadModel>> Put([FromRoute] string orgUr
}

[HttpDelete]
[Route("delete/{agreementId:int}")]
[Route("{agreementId:int}")]
public async Task<ActionResult> Delete([FromRoute] string orgUrlKey, [FromRoute] int agreementId, CancellationToken ct)
{
var selectedOrg = await organisationRepository.GetOrganizationByUrlKey(orgUrlKey, ct);
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/actions/agreementActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export async function getAgreementsForProject(
) {
try {
const res = await fetchWithToken<Agreement[]>(
`${orgUrlKey}/agreements/get/engagement/${projectId}`,
`${orgUrlKey}/agreements/engagement/${projectId}`,
);

let agreementsWithDateTypes: Agreement[] = [];
Expand All @@ -154,7 +154,7 @@ export async function getAgreementsForCustomer(
) {
try {
const res = await fetchWithToken<Agreement[]>(
`${orgUrlKey}/agreements/get/customer/${customerId}`,
`${orgUrlKey}/agreements/customer/${customerId}`,
);

let agreementsWithDateTypes: Agreement[] = [];
Expand All @@ -170,7 +170,7 @@ export async function getAgreementsForCustomer(
export async function updateAgreement(agreement: Agreement, orgUrlKey: string) {
try {
const res = await putWithToken<Agreement, Agreement>(
`${orgUrlKey}/agreements/update/${agreement.agreementId}`,
`${orgUrlKey}/agreements/${agreement.agreementId}`,
agreement,
);

Expand All @@ -190,7 +190,7 @@ export async function createAgreement(
) {
try {
const res = await postWithToken<Agreement, AgreementWriteModel>(
`${orgUrlKey}/agreements/create`,
`${orgUrlKey}/agreements`,
agreement,
);
let agreementWithDateTypes: Agreement | null = null;
Expand All @@ -206,7 +206,7 @@ export async function createAgreement(
export async function deleteAgreement(agreementId: number, orgUrlKey: string) {
try {
const res = await deleteWithToken<Agreement, Agreement>(
`${orgUrlKey}/agreements/delete/${agreementId}`,
`${orgUrlKey}/agreements/${agreementId}`,
);

return res;
Expand Down

0 comments on commit 1bd1278

Please sign in to comment.