Skip to content

Commit

Permalink
fix: reverse order of projects
Browse files Browse the repository at this point in the history
  • Loading branch information
nostrdev-com committed Dec 18, 2024
1 parent f5fb3a7 commit f9f6563
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions backend/src/api/angor/angor.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class AngorRoutes {
}))
.sort(
(p1: ProjectsPayloadItem, p2: ProjectsPayloadItem) =>
p1.createdOnBlock - p2.createdOnBlock
p2.createdOnBlock - p1.createdOnBlock
);

// Amount of confirmed Angor projects.
Expand Down Expand Up @@ -235,7 +235,6 @@ class AngorRoutes {
const spentVouts: AngorVout[][] = await Promise.all(
investments.map(async (investment) => {
//fetch transaction for each investment, with full info about vouts
console.log('investment: ', investment);
const fullTr = await transactionUtils.$getTransactionExtended(
investment.transaction_id,
true,
Expand Down Expand Up @@ -351,7 +350,6 @@ class AngorRoutes {
return;
}
}

// Angor project investments.
const projectInvestments =
await AngorProjectRepository.$getProjectInvestments(
Expand All @@ -361,15 +359,17 @@ class AngorRoutes {
);

// Adjust DB data to confirm ProjectInvestmentPayloadItem interface.
const payload: ProjectInvestmentPayloadItem[] = projectInvestments
const payload: ProjectInvestmentPayloadItem[] = projectInvestments.length > 0
? projectInvestments
.map((investment) => ({
investorPublicKey: investment.investor_npub,
totalAmount: investment.amount_sats,
transactionId: investment.transaction_id,
hashOfSecret: investment.secret_hash,
isSeeder: investment.is_seeder,
}))
.sort();
.sort()
: [];

// Amount of confirmed Angor project investments.
const investmentsCount =
Expand Down
2 changes: 1 addition & 1 deletion backend/src/repositories/AngorProjectRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class AngorProjectRepository {
nostrEventId?: string
): Promise<void> {
try {
logger.debug(`nostrEventId=${nostrEventId}`);
const query = `INSERT INTO angor_projects
(
id,
Expand Down Expand Up @@ -214,6 +213,7 @@ class AngorProjectRepository {
LEFT JOIN angor_investments
ON angor_projects.address_on_fee_output = angor_investments.address_on_fee_output
WHERE angor_projects.id = '${id}'
AND angor_investments.address_on_fee_output IS NOT NULL
${
investorPubKey
? `AND angor_investments.investor_npub = '${investorPubKey}'`
Expand Down

0 comments on commit f9f6563

Please sign in to comment.