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

SuperFluid Release fix test actual matching View #1497

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions migration/1713700147145-project_actual_matchin_view_15.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ export class ProjectActualMatchinView151713700147145
STRING_AGG(DISTINCT CONCAT(pa."networkId", '-', pa."address"), ', ') AS "networkAddresses"
FROM
public.project p
CROSS JOIN public.qf_round qr
INNER JOIN project_qf_rounds_qf_round pqrq ON pqrq."projectId" = p.id
INNER JOIN public."user" u on p."adminUserId" = u.id
INNER JOIN public.qf_round qr on qr.id = pqrq."qfRoundId"
LEFT JOIN project_address pa ON pa."projectId" = p.id AND pa."networkId" = ANY(qr."eligibleNetworks") AND pa."isRecipient" = true
group by
group by
p.id,
u.email,
qr.id
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/notifications/NotificationCenterAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class NotificationCenterAdapter implements NotificationAdapterInterface {
isEnded: boolean;
networkName: string;
}): Promise<void> {
logger.debug('userSuperTokensCritical', { params });
logger.debug('userSuperTokensCritical has been called', { params });
const { eventName, tokenSymbol, project, user, isEnded, networkName } =
params;
const { email, walletAddress } = user;
Expand Down
18 changes: 16 additions & 2 deletions src/services/recurringDonationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ import {
getNotificationAdapter,
getSuperFluidAdapter,
} from '../adapters/adaptersFactory';
import { DONATION_STATUS, Donation } from '../entities/donation';
import { Donation, DONATION_STATUS } from '../entities/donation';
import {
RECURRING_DONATION_STATUS,
RecurringDonation,
} from '../entities/recurringDonation';
import { Token } from '../entities/token';
import { getProvider, NETWORK_IDS, superTokensToToken } from '../provider';
import {
getNetworkNameById,
getProvider,
NETWORK_IDS,
superTokensToToken,
} from '../provider';
import { findProjectRecipientAddressByNetworkId } from '../repositories/projectAddressRepository';
import { findProjectById } from '../repositories/projectRepository';
import {
Expand All @@ -31,6 +36,7 @@ import { calculateGivbackFactor } from './givbackService';
import { updateUserTotalDonated, updateUserTotalReceived } from './userService';
import config from '../config';
import { User } from '../entities/user';
import { NOTIFICATIONS_EVENT_NAMES } from '../analytics/analytics';

// Initially it will only be monthly data
export const priceDisplay = 'month';
Expand Down Expand Up @@ -78,6 +84,14 @@ export const createRelatedDonationsToStream = async (
recurringDonation.finished = true;
recurringDonation.status = RECURRING_DONATION_STATUS.ENDED;
await recurringDonation.save();
await getNotificationAdapter().userSuperTokensCritical({
user: recurringDonation.donor,
eventName: NOTIFICATIONS_EVENT_NAMES.SUPER_TOKENS_BALANCE_DEPLETED,
tokenSymbol: recurringDonation.currency,
isEnded: recurringDonation.finished,
project: recurringDonation.project,
networkName: getNetworkNameById(recurringDonation.networkId),
});
}

const project = await findProjectById(recurringDonation.projectId);
Expand Down
Loading