Skip to content

Commit

Permalink
changed route params to avoid deploy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Florin H committed Mar 1, 2023
1 parent 7916d2f commit 112ea5f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ functions:
handler: src/components/coauthor/routes.sendApprovalReminder
events:
- http:
path: ${self:custom.versions.v1}/publications/{publicationId}/coauthors/{authorId}/approval-reminder
path: ${self:custom.versions.v1}/publications/{id}/coauthors/{coauthor}/approval-reminder
method: POST
cors: true
getFlag:
Expand Down
8 changes: 7 additions & 1 deletion api/src/components/coauthor/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const get = async (
return response.json(200, coAuthors);
} catch (err) {
console.log(err);

return response.json(500, { message: 'Unknown server error.' });
}
};
Expand Down Expand Up @@ -147,6 +148,7 @@ export const remove = async (
return response.json(200, { message: 'Co-author deleted from this publication' });
} catch (err) {
console.log(err);

return response.json(500, { message: 'Unknown server error.' });
}
};
Expand Down Expand Up @@ -242,6 +244,7 @@ export const link = async (
return response.json(200, 'Linked user account');
} catch (err) {
console.log(err);

return response.json(500, { message: 'Unknown server error.' });
}
};
Expand Down Expand Up @@ -307,6 +310,7 @@ export const updateConfirmation = async (
return response.json(200, { message: 'This co-author has changed their confirmation status.' });
} catch (err) {
console.log(err);

return response.json(500, { message: 'Unknown server error.' });
}
};
Expand Down Expand Up @@ -344,14 +348,15 @@ export const requestApproval = async (
return response.json(200, coAuthors);
} catch (err) {
console.log(err);

return response.json(500, { message: 'Unknown server error.' });
}
};

export const sendApprovalReminder = async (
event: I.AuthenticatedAPIRequest<undefined, undefined, I.SendApprovalReminderPathParams>
): Promise<I.JSONResponse> => {
const { authorId, publicationId } = event.pathParameters;
const { coauthor: authorId, id: publicationId } = event.pathParameters;

const publication = await publicationService.get(publicationId);
const author = await coAuthorService.get(authorId);
Expand Down Expand Up @@ -419,6 +424,7 @@ export const sendApprovalReminder = async (
await coAuthorService.update(authorId, { reminderDate: new Date() });
} catch (error) {
console.log(error);

return response.json(500, { message: 'Unknown server error' });
}

Expand Down
6 changes: 3 additions & 3 deletions api/src/components/coauthor/schema/sendApprovalReminder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import * as I from 'interface';
const sendApprovalReminder: I.JSONSchemaType<I.SendApprovalReminderPathParams> = {
type: 'object',
properties: {
authorId: {
coauthor: {
type: 'string'
},
publicationId: {
id: {
type: 'string'
}
},
required: ['authorId', 'publicationId']
required: ['coauthor', 'id']
};

export default sendApprovalReminder;
4 changes: 2 additions & 2 deletions api/src/lib/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,6 @@ export interface UserPublicationsFilters {
}

export interface SendApprovalReminderPathParams {
publicationId: string;
authorId: string;
id: string;
coauthor: string;
}

0 comments on commit 112ea5f

Please sign in to comment.