-
Notifications
You must be signed in to change notification settings - Fork 9
created the hooks for getting sponsors, sponsor-tasks, deleting a spo… #3386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5a833a9
424e6d1
5fda110
4807213
dbeedf7
620ded8
fd3fc37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,15 @@ | |
| * This file is part of NER's FinishLine and licensed under GNU AGPLv3. | ||
| * See the LICENSE file in the repository root folder for details. | ||
| */ | ||
| import { sponsorTaskTranformer, sponsorTransformer } from '../../../backend/src/transformers/finance.transformer'; | ||
| import { | ||
| CreateReimbursementRequestPayload, | ||
| EditReimbursementRequestPayload, | ||
| EditVendorPayload, | ||
| AccountCodePayload, | ||
| RefundPayload, | ||
| MarkDeliveredRequestPayload | ||
| MarkDeliveredRequestPayload, | ||
| EditSponsorTierPayload | ||
| } from '../hooks/finance.hooks'; | ||
| import axios from '../utils/axios'; | ||
| import { apiUrls } from '../utils/urls'; | ||
|
|
@@ -19,7 +21,7 @@ import { | |
| } from './transformers/reimbursement-requests.transformer'; | ||
| import { saveAs } from 'file-saver'; | ||
| import { PDFDocument, PDFImage } from 'pdf-lib'; | ||
| import { IndexCode, AccountCode, ReimbursementRequest, OtherProductReason } from 'shared'; | ||
| import { IndexCode, AccountCode, ReimbursementRequest, OtherProductReason, Sponsor, SponsorTask } from 'shared'; | ||
|
|
||
| enum AllowedFileType { | ||
| JPEG = 'image/jpeg', | ||
|
|
@@ -404,3 +406,53 @@ export const getAllOtherProductReason = () => { | |
| transformResponse: (data) => JSON.parse(data) as OtherProductReason[] | ||
| }); | ||
| }; | ||
|
|
||
| /** | ||
| * API call to get the list of all sponsors | ||
| * | ||
| * @returns the list of all sponsors | ||
| */ | ||
|
|
||
| export const getAllSponsors = () => { | ||
| return axios.get<Sponsor[]>(apiUrls.getAllSponsors(), { | ||
| transformResponse: (data) => JSON.parse(data).map(sponsorTransformer) | ||
| }); | ||
| }; | ||
|
|
||
| /** | ||
| * API call to the sponsor tasks for a given sponsor | ||
| * | ||
| * @param sponsorId the id of the sponsor which tasks are retrieved | ||
| * | ||
| * @returns the list of tasks for a given sponsor | ||
| */ | ||
|
|
||
| export const getsponsorTasks = (sponsorId: string) => { | ||
|
||
| return axios.get<SponsorTask[]>(apiUrls.getSponsorTasks(sponsorId), { | ||
| transformResponse: (data) => JSON.parse(data).map(sponsorTaskTranformer) | ||
| }); | ||
| }; | ||
|
|
||
| /** | ||
| * API call to delete a given sponsor | ||
| * | ||
| * @param sponsorId the id of the sponsor to delete | ||
| * | ||
| * @returns the deleted sponsor | ||
| */ | ||
|
|
||
| export const deleteSponsor = (sponsorId: string) => { | ||
| return axios.delete(apiUrls.deleteSponsor(sponsorId)); | ||
| }; | ||
|
|
||
| /** | ||
| * API call to edit a sponsor tier | ||
| * | ||
| * @param sponsorTierData the edited data of the sponsor tier | ||
| * @param sponsorTierId the id of the sponsor tier to be edited | ||
| * | ||
| * @returns the edited sponosor tier | ||
| */ | ||
| export const editSponsorTier = (sponsorTierId: string, sponsorTierData: EditSponsorTierPayload) => { | ||
|
||
| return axios.post(apiUrls.editSponsorTier(sponsorTierId), sponsorTierData); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,11 @@ const financeEditVendor = (vendorId: string) => `${financeEndpoints()}/${vendorI | |
| const financeLeadershipApprove = (id: string) => `${financeEndpoints()}/${id}/leadership-approve`; | ||
| const getAllIndexCodes = () => `${financeEndpoints()}/index-codes`; | ||
| const getAllOtherProductReasons = () => `${financeEndpoints()}/other-reimbursement-product-reasons`; | ||
| const financeRoutesEndpoints = () => `${API_URL}/finance`; | ||
| const getAllSponsors = () => `${financeRoutesEndpoints()}/sponsors`; | ||
| const getSponsorTasks = (sponsorId: string) => `${financeRoutesEndpoints()}/sponsors/${sponsorId}/tasks`; | ||
|
||
| const deleteSponsor = (sponsorId: string) => `${financeRoutesEndpoints()}/sponsors/${sponsorId}/delete`; | ||
| const editSponsorTier = (sponsorTierId: string) => `${financeRoutesEndpoints()}/sponsorTier/${sponsorTierId}/edit`; | ||
|
|
||
| /**************** Bill of Material Endpoints **************************/ | ||
| const bomEndpoints = () => `${API_URL}/projects/bom`; | ||
|
|
@@ -370,6 +375,10 @@ export const apiUrls = { | |
| financeLeadershipApprove, | ||
| getAllIndexCodes, | ||
| getAllOtherProductReasons, | ||
| getAllSponsors, | ||
| getSponsorTasks, | ||
| deleteSponsor, | ||
| editSponsorTier, | ||
|
|
||
| bomEndpoints, | ||
| bomGetMaterialsByWbsNum, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know you didn't do this but can you remove the as OtherProductReason[], I think its redundant here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with as IndexCode above