Skip to content
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

feat(pg-migration): Add Postgres Migration Support for Funds & Fundraising Campaigns in orgDashboard #3591

Open
wants to merge 23 commits into
base: develop-postgres
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c0bb868
feat(pg-migration): funds and fundraising campaigns
Bittukr7479 Feb 12, 2025
7777d19
Fix error
Bittukr7479 Feb 12, 2025
9397b5d
Fix error
Bittukr7479 Feb 12, 2025
1a653b5
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 12, 2025
fcf1b7c
Fix typecheck error
Bittukr7479 Feb 13, 2025
f8acf36
Fix typecheck error
Bittukr7479 Feb 13, 2025
39e2ec9
Fix error
Bittukr7479 Feb 13, 2025
236de12
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 13, 2025
de523a0
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 14, 2025
ef61072
Fix error
Bittukr7479 Feb 14, 2025
2b552c2
Fix error
Bittukr7479 Feb 14, 2025
b475710
Fix error
Bittukr7479 Feb 14, 2025
7b9aa88
Error fix
Bittukr7479 Feb 14, 2025
93f06d8
Error fix
Bittukr7479 Feb 14, 2025
7ef1d13
Fix error
Bittukr7479 Feb 14, 2025
9772bc7
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 14, 2025
000bc5a
Error fix
Bittukr7479 Feb 14, 2025
b20bb0c
Error fix
Bittukr7479 Feb 14, 2025
c0261f9
Fix error
Bittukr7479 Feb 14, 2025
61f5d1d
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 15, 2025
3ef8c37
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 15, 2025
a185ece
Improve code coverage for: src\screens\OrganizationFunds\Organization…
Bittukr7479 Feb 15, 2025
04d9b59
Merge branch 'develop-postgres' into pg-migration-funds-and-fundraisi…
Bittukr7479 Feb 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 24 additions & 42 deletions src/GraphQl/Mutations/CampaignMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,33 @@ import gql from 'graphql-tag';
*
* @param name - The name of the fund.
* @param fundId - The fund ID the campaign is associated with.
* @param fundingGoal - The funding goal of the campaign.
* @param startDate - The start date of the campaign.
* @param endDate - The end date of the campaign.
* @param currency - The currency of the campaign.
* @param goalAmount - The funding goal of the campaign.
* @param startAt - The start date of the campaign.
* @param endAt - The end date of the campaign.
* @param currencyCode - The currency of the campaign.
* @returns The ID of the created campaign.
*/

export const CREATE_CAMPAIGN_MUTATION = gql`
mutation createFundraisingCampaign(
$fundId: ID!
$organizationId: ID!
mutation createFundCampaign(
$name: String!
$fundingGoal: Float!
$startDate: Date!
$endDate: Date!
$currency: Currency!
$fundId: ID!
$goalAmount: Int!
$startAt: DateTime!
$endAt: DateTime!
$currencyCode: Iso4217CurrencyCode!
) {
createFundraisingCampaign(
data: {
createFundCampaign(
input: {
fundId: $fundId
organizationId: $organizationId
name: $name
fundingGoal: $fundingGoal
startDate: $startDate
endDate: $endDate
currency: $currency
goalAmount: $goalAmount
startAt: $startAt
endAt: $endAt
currencyCode: $currencyCode
}
) {
_id
id
}
}
`;
Expand All @@ -43,33 +41,17 @@ export const CREATE_CAMPAIGN_MUTATION = gql`
*
* @param id - The ID of the campaign being updated.
* @param name - The name of the campaign.
* @param fundingGoal - The funding goal of the campaign.
* @param startDate - The start date of the campaign.
* @param endDate - The end date of the campaign.
* @param currency - The currency of the campaign.
* @param goalAmount - The funding goal of the campaign.
* @param startAt - The start date of the campaign.
* @param endAt - The end date of the campaign.
// * @param currencyCode - The currency of the campaign.
* @returns The ID of the updated campaign.
*/

export const UPDATE_CAMPAIGN_MUTATION = gql`
mutation updateFundraisingCampaign(
$id: ID!
$name: String
$fundingGoal: Float
$startDate: Date
$endDate: Date
$currency: Currency
) {
updateFundraisingCampaign(
id: $id
data: {
name: $name
fundingGoal: $fundingGoal
startDate: $startDate
endDate: $endDate
currency: $currency
}
) {
_id
mutation updateFundCampaign($input: MutationUpdateFundCampaignInput!) {
updateFundCampaign(input: $input) {
id
}
}
`;
44 changes: 8 additions & 36 deletions src/GraphQl/Mutations/FundMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,23 @@ import gql from 'graphql-tag';
*
* @param name - The name of the fund.
* @param organizationId - The organization ID the fund is associated with.
* @param refrenceNumber - The reference number of the fund.
* @param taxDeductible - Whether the fund is tax deductible.
* @param isArchived - Whether the fund is archived.
* @param isDefault - Whether the fund is the default.
* @param isTaxDeductible - Whether the fund is tax deductible.
* @returns The ID of the created fund.
*/
export const CREATE_FUND_MUTATION = gql`
mutation CreateFund(
$name: String!
$organizationId: ID!
$refrenceNumber: String
$taxDeductible: Boolean!
$isArchived: Boolean!
$isDefault: Boolean!
$isTaxDeductible: Boolean!
) {
createFund(
data: {
input: {
name: $name
organizationId: $organizationId
refrenceNumber: $refrenceNumber
taxDeductible: $taxDeductible
isArchived: $isArchived
isDefault: $isDefault
isTaxDeductible: $isTaxDeductible
}
) {
_id
id
}
}
`;
Expand All @@ -40,32 +31,13 @@ export const CREATE_FUND_MUTATION = gql`
*
* @param id - The ID of the fund being updated.
* @param name - The name of the fund.
* @param refrenceNumber - The reference number of the fund.
* @param taxDeductible - Whether the fund is tax deductible.
* @param isArchived - Whether the fund is archived.
* @param isDefault - Whether the fund is the default.
* @returns The ID of the updated fund.
*/
export const UPDATE_FUND_MUTATION = gql`
mutation UpdateFund(
$id: ID!
$name: String
$refrenceNumber: String
$taxDeductible: Boolean
$isArchived: Boolean
$isDefault: Boolean
) {
updateFund(
id: $id
data: {
name: $name
refrenceNumber: $refrenceNumber
taxDeductible: $taxDeductible
isArchived: $isArchived
isDefault: $isDefault
}
) {
_id
mutation UpdateFund($input: MutationUpdateFundInput!) {
updateFund(input: $input) {
id
}
}
`;
128 changes: 59 additions & 69 deletions src/GraphQl/Queries/fundQueries.ts
Original file line number Diff line number Diff line change
@@ -1,87 +1,77 @@
/*eslint-disable*/
import gql from 'graphql-tag';

/**
* GraphQL query to retrieve the list of members for a specific organization.
* GraphQL query to retrieve the list of funds for a specific organization.
*
* @param id - The ID of the organization for which members are being retrieved.
* @param filter - The filter to search for a specific member.
* @returns The list of members associated with the organization.
* @param id - The ID of the organization for which funds are being retrieved.
* @returns The list of funds associated with the organization.
*/
export const FUND_LIST = gql`
query FundsByOrganization(
$organizationId: ID!
$filter: String
$orderBy: FundOrderByInput
) {
fundsByOrganization(
organizationId: $organizationId
where: { name_contains: $filter }
orderBy: $orderBy
) {
_id
name
refrenceNumber
taxDeductible
isDefault
isArchived
createdAt
organizationId
creator {
_id
firstName
lastName
query FundsByOrganization($input: QueryOrganizationInput!) {
organization(input: $input) {
funds(first: 32) {
edges {
node {
id
name
creator {
id
}
createdAt
}
}
}
}
}
`;

/**
* Query to fetch a specific fund by its ID, along with its associated campaigns.
* @param id - The ID of the fund campaign to be fetched.
* @param name - The name of the fund campaign to be fetched.
* @param startAt - The start date of the fund campaign to be fetched.
* @param endAt - The end date of the fund campaign to be fetched.
* @param currencyCode - The currency code of the fund campaign to be fetched.
* @param goalAmount - The goal amount of the fund campaign to be fetched.
* @returns The fund campaign with the specified ID.
*/
export const FUND_CAMPAIGN = gql`
query GetFundById(
$id: ID!
$where: CampaignWhereInput
$orderBy: CampaignOrderByInput
) {
getFundById(id: $id, where: $where, orderBy: $orderBy) {
query GetFundById($input: QueryFundInput!) {
fund(input: $input) {
id
name
isArchived
campaigns {
_id
endDate
fundingGoal
name
startDate
currency
campaigns(first: 10) {
edges {
node {
id
name
startAt
endAt
currencyCode
goalAmount
}
}
}
}
}
`;

export const FUND_CAMPAIGN_PLEDGE = gql`
query GetFundraisingCampaigns(
$where: CampaignWhereInput
$pledgeOrderBy: PledgeOrderByInput
) {
getFundraisingCampaigns(where: $where, pledgeOrderBy: $pledgeOrderBy) {
fundId {
name
}
query GetFundCampaignPledges($input: QueryFundCampaignInput!) {
fundCampaign(input: $input) {
id
name
fundingGoal
currency
startDate
endDate
pledges {
_id
amount
currency
endDate
startDate
users {
_id
firstName
lastName
image
pledges(first: 10) {
edges {
node {
id
amount
note
pledger {
id
name
}
}
}
}
}
Expand All @@ -93,13 +83,13 @@ export const USER_FUND_CAMPAIGNS = gql`
$where: CampaignWhereInput
$campaignOrderBy: CampaignOrderByInput
) {
getFundraisingCampaigns(where: $where, campaignOrderby: $campaignOrderBy) {
_id
startDate
endDate
getFundraisingCampaigns(where: $where, campaignOrderBy: $campaignOrderBy) {
id
name
fundingGoal
currency
fundingGoal
startDate
endDate
}
}
`;
Expand Down
2 changes: 1 addition & 1 deletion src/screens/FundCampaignPledge/FundCampaignPledge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const fundCampaignPledge = (): JSX.Element => {
>;
} = useQuery(FUND_CAMPAIGN_PLEDGE, {
variables: {
where: {
input: {
id: fundCampaignId,
},
pledgeOrderBy: sortBy,
Expand Down
20 changes: 10 additions & 10 deletions src/screens/OrganizationFundCampaign/CampaignModal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ const campaignProps: InterfaceCampaignModal[] = [
fundId: 'fundId',
orgId: 'orgId',
campaign: {
_id: 'campaignId1',
id: 'campaignId1',
name: 'Campaign 1',
fundingGoal: 100,
startDate: new Date('2021-01-01'),
endDate: new Date('2024-01-01'),
currency: 'USD',
goalAmount: 100,
startAt: new Date('2021-01-01'),
endAt: new Date('2024-01-01'),
currencyCode: 'USD',
createdAt: '2021-01-01',
},
refetchCampaign: vi.fn(),
Expand All @@ -69,12 +69,12 @@ const campaignProps: InterfaceCampaignModal[] = [
fundId: 'fundId',
orgId: 'orgId',
campaign: {
_id: 'campaignId1',
id: 'campaignId1',
name: 'Campaign 1',
fundingGoal: 100,
startDate: new Date('2021-01-01'),
endDate: new Date('2024-01-01'),
currency: 'USD',
goalAmount: 100,
startAt: new Date('2021-01-01'),
endAt: new Date('2024-01-01'),
currencyCode: 'USD',
createdAt: '2021-01-01',
},
refetchCampaign: vi.fn(),
Expand Down
Loading
Loading