Skip to content

Commit e3504cc

Browse files
committed
feat: manageable edition nfts
1 parent df6c1c0 commit e3504cc

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/main/resources/db/migration/V1.0.4__Baseline_API.sql

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ FROM (
274274
edition_size AS total,
275275
COUNT(*) AS minted,
276276
count(CASE WHEN burned THEN 1 end) AS burned,
277-
CASE WHEN edition_size != 0 THEN edition_size - COUNT(*) ELSE 0 END AS mintable,
277+
CASE WHEN edition_size != 0 THEN edition_size - COUNT(*) ELSE -1 END AS mintable,
278278
MAX(t1.mint_date) AS last_minting_date
279279
FROM soonmarket_nft t1
280280
WHERE edition_size != 1
@@ -283,6 +283,16 @@ LEFT JOIN LATERAL (SELECT * from soonmarket_nft WHERE t1.template_id=template_id
283283
UNION ALL
284284
SELECT NULL,NULL,NULL,NULL, * FROM soonmarket_nft WHERE edition_size=1)t
285285

286+
COMMENT ON VIEW soonmarket_manageable_nft_v IS 'View for manageable NFTs (parent row, creators)';
287+
288+
--
289+
290+
CREATE OR replace VIEW soonmarket_manageable_edition_nft_v as
291+
SELECT *
292+
FROM soonmarket_nft WHERE edition_size!=1;
293+
294+
COMMENT ON VIEW soonmarket_manageable_edition_nft_v IS 'View for manageable edition NFTs (child row, creators)';
295+
286296
----------------------------------
287297
-- Collection Detail View
288298
----------------------------------
@@ -331,14 +341,17 @@ COALESCE(b1.reporter_comment,b2.reporter_comment) AS blacklist_reason,
331341
CASE WHEN b1.reporter is not null THEN 'NFT Watch' WHEN b2.reporter is not null THEN 'Soon.Market' ELSE null END AS blacklist_actor,
332342
CASE WHEN s1.collection_id IS NOT NULL or s2.collection_id IS NOT NULL THEN TRUE ELSE FALSE END AS shielded,
333343
t2.name,
334-
t2.description
344+
t2.description,
345+
t5.schema_id,
346+
t5.schema_name
335347
FROM atomicassets_collection t1
336348
LEFT JOIN atomicassets_collection_data_log t2 ON t1.collection_id = t2.collection_id and t2.current
337349
LEFT JOIN atomicassets_collection_royalty_log t3 ON t1.collection_id = t3.collection_id and t3.current
338350
LEFT JOIN nft_watch_blacklist b1 ON t1.collection_id = b1.collection_id
339351
LEFT JOIN soonmarket_internal_blacklist b2 ON t1.collection_id = b2.collection_id
340352
LEFT JOIN nft_watch_shielding s1 ON t1.collection_id = s1.collection_id
341-
LEFT JOIN soonmarket_internal_shielding s2 ON t1.collection_id = s2.collection_id;
353+
LEFT JOIN soonmarket_internal_shielding s2 ON t1.collection_id = s2.collection_id
354+
LEFT JOIN LATERAL (SELECT string_agg(schema_id,',') AS schema_id,string_agg(SCHEMA_NAME,',') AS schema_name FROM atomicassets_schema WHERE t1.collection_id=collection_id GROUP BY t1.collection_id)t5 ON true;;
342355

343356
----------------------------------
344357
-- Edition

0 commit comments

Comments
 (0)