Skip to content

Commit

Permalink
fix(api): multiple parent display
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Feb 18, 2025
1 parent 3c1582e commit 703f98f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/ordinals/src/pg/pg-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class PgStore extends BasePgStore {
i.curse_type,
i.ordinal_number AS sat_ordinal,
(
SELECT ip.parent_inscription_id
SELECT STRING_AGG(ip.parent_inscription_id, ',')
FROM inscription_parents AS ip
WHERE ip.inscription_id = i.inscription_id
) AS parent_refs,
Expand Down
7 changes: 6 additions & 1 deletion api/ordinals/tests/api/inscriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('/inscriptions', () => {
expect(response2.json()).toStrictEqual(expected);
});

test('shows inscription with parent', async () => {
test('shows inscription with parents', async () => {
await inscriptionReveal(db.sql, {
inscription_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0',
ordinal_number: '257418248345364',
Expand Down Expand Up @@ -296,13 +296,18 @@ describe('/inscriptions', () => {
inscription_id: 'f351d86c6e6cae3c64e297e7463095732f216875bcc1f3c03f950a492bb25421i0',
parent_inscription_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0',
});
await insertTestInscriptionParent(db.sql, {
inscription_id: 'f351d86c6e6cae3c64e297e7463095732f216875bcc1f3c03f950a492bb25421i0',
parent_inscription_id: '001eec2c3fb12441057722b099ae22f4d67602e2e7add0bd018132c0b128cde3i0',
});
const response = await fastify.inject({
method: 'GET',
url: '/ordinals/v1/inscriptions/f351d86c6e6cae3c64e297e7463095732f216875bcc1f3c03f950a492bb25421i0',
});
expect(response.statusCode).toBe(200);
expect(response.json().parent_refs).toStrictEqual([
'9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0',
'001eec2c3fb12441057722b099ae22f4d67602e2e7add0bd018132c0b128cde3i0',
]);
});

Expand Down

0 comments on commit 703f98f

Please sign in to comment.