-
Notifications
You must be signed in to change notification settings - Fork 47
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
Create a new internal campaing for members and their fees. #527
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
migrations/20230802161354_insert_membership_campaign_type/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Add a new campaign type for membership campaigns | ||
|
||
INSERT INTO api.campaign_types (name, slug, description, parent_id, category) | ||
VALUES ('Membership', 'membership', 'Membership Campaigns', null, 'others'); | ||
|
55 changes: 55 additions & 0 deletions
55
migrations/20230802163505_insert_membership_campaign/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--insert an internal campaign for members only and their membership fee | ||
--insert an internal campaign for members only and their membership fee | ||
DO $$ | ||
DECLARE | ||
v_coordinator_id UUID; | ||
v_beneficiary_id UUID; | ||
v_campaign_type_id UUID; | ||
|
||
BEGIN | ||
|
||
select id INTO v_coordinator_id from coordinators limit 1; | ||
select id INTO v_beneficiary_id from beneficiaries where coordinator_id = v_coordinator_id limit 1; | ||
select id INTO v_campaign_type_id from campaign_types where name = 'Membership'; | ||
|
||
IF v_beneficiary_id IS NULL THEN | ||
RETURN; | ||
END IF; | ||
|
||
insert into campaigns ( | ||
state, | ||
slug, | ||
title, | ||
coordinator_id, | ||
beneficiary_id, | ||
campaign_type_id, | ||
essence, | ||
description, | ||
target_amount, | ||
start_date, | ||
end_date, | ||
created_at, | ||
updated_at, | ||
currency, | ||
allow_donation_on_complete, | ||
payment_reference) | ||
values ('approved', | ||
'podkrepi-membership', | ||
'Podkrepi.bg membership', | ||
v_coordinator_id, | ||
v_beneficiary_id, | ||
v_campaign_type_id, | ||
'Internal campaign for members only', | ||
'Internal campaign for members only. Here you can pay your membership fee. Subscribe it as an annual donation in this campaign.', | ||
10000000, | ||
NOW(), | ||
'2123-08-01', | ||
NOW(), | ||
NOW(), | ||
'BGN', | ||
true, | ||
'46M3-3ARQ-R326' | ||
); | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Inserting a campaign on an empty DB is too much of a hustle.
Too many objects need to be created from scratch (coordinator, person, city, country...)