You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/resources/db/migration/V1.0.4__Baseline_API.sql
+35-6Lines changed: 35 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -195,13 +195,13 @@ CREATE OR REPLACE VIEW soonmarket_nft_detail_v AS
195
195
t2.listing_id,
196
196
t3.auction_id
197
197
FROM soonmarket_asset_v t1
198
-
LEFT JOIN (selectmax(listing_id) AS listing_id,asset_id from soonmarket_listing_v t2 where not bundle GROUP BY asset_id)t2 ONt1.asset_id=t2.asset_idAND NOT t1.burned
198
+
LEFT JOIN (selectmax(listing_id) AS listing_id,asset_id from soonmarket_listing_v t2 where not bundle GROUP BY asset_idand state is null)t2 ONt1.asset_id=t2.asset_idAND NOT t1.burned
199
199
LEFT JOIN (selectmax(auction_Id) as auction_id,asset_id from soonmarket_auction_v t3 where active group by asset_id)t3 ONt1.asset_id=t3.asset_idAND NOT t1.burned;
200
200
201
201
COMMENT ON VIEW soonmarket_nft_detail_v IS 'View for NFT Details';
202
202
203
203
-----------------------------------------
204
-
-- MyNFTs Mat-View TODO: move to function
204
+
-- MyNFTs View
205
205
-----------------------------------------
206
206
207
207
CREATEVIEWsoonmarket_my_nfts_vas
@@ -235,25 +235,54 @@ SELECT
235
235
t7.tokenas auction_token,
236
236
t7.starting_priceas auction_starting_bid,
237
237
t7.current_bidas auction_current_bid,
238
-
COALESCE(t7.bundle,false) AS bundle,
238
+
COALESCE(t7.bundle,t8.bundle,false) AS bundle,
239
239
t8.listing_id,
240
240
t8.listing_date,
241
241
t8.listing_token,
242
242
t8.listing_price,
243
243
t9.price,
244
-
t9.token
244
+
t9.token,
245
+
COALESCE(COALESCE(t7.current_bid,t7.starting_price),t8.listing_price) AS filter_price_usd
LEFT JOIN atomicassets_asset_data t3 ONt1.asset_id=t3.asset_id
248
249
LEFT JOIN soonmarket_template_v t4 ONt2.template_id=t4.template_id
249
250
LEFT JOIN soonmarket_collection_v t5 ont2.collection_id=t5.collection_id
250
251
left JOIN LATERAL (SELECT auction_id,auction_end,token,starting_price,current_bid,bundle from soonmarket_auction_base_v wheret1.asset_id=asset_id AND active) t7 ON true
251
-
left JOIN LATERAL (SELECT listing_id,listing_date,listing_token,listing_price,bundle fromsoonmarket_listing_open_vwheret1.asset_id=asset_id)t8 ON true
252
+
left JOIN LATERAL (SELECT listing_id,listing_date,listing_token,listing_price,bundle fromsoonmarket_listing_valid_mvwheret1.asset_id=asset_id)t8 ON true
252
253
LEFT JOIN soonmarket_last_sold_for_asset_v t9 ONt1.asset_id=t9.asset_idAND buyer=OWNER
253
-
WHEREt1.CURRENT;
254
+
WHEREt1.CURRENTAND NOT blacklisted
254
255
255
256
COMMENT ON VIEW soonmarket_my_nfts_v IS 'View for MyNFTs';
256
257
258
+
-----------------------------------------
259
+
-- Manage NFTs View
260
+
-----------------------------------------
261
+
262
+
CREATE OR replaceVIEWsoonmarket_manageable_nft_vas
263
+
SELECT*FROM(
264
+
SELECT
265
+
t1.minted-t1.burnedAS num_circulating,
266
+
t1.burnedAS num_burned,
267
+
t1.mintableAS num_mintable,
268
+
t1.last_minting_date,
269
+
t2.*
270
+
FROM (
271
+
SELECT
272
+
creator,
273
+
template_id,
274
+
edition_size AS total,
275
+
COUNT(*) AS minted,
276
+
count(CASE WHEN burned THEN 1 end) AS burned,
277
+
CASE WHEN edition_size !=0 THEN edition_size -COUNT(*) ELSE 0 END AS mintable,
278
+
MAX(t1.mint_date) AS last_minting_date
279
+
FROM soonmarket_nft t1
280
+
WHERE edition_size !=1
281
+
GROUP BY template_id,edition_size,creator) t1
282
+
LEFT JOIN LATERAL (SELECT*from soonmarket_nft WHEREt1.template_id=template_id ANDt1.creator=creator AND edition_size!=1LIMIT1)t2 ON TRUE
283
+
UNION ALL
284
+
SELECTNULL,NULL,NULL,NULL, *FROM soonmarket_nft WHERE edition_size=1)t
0 commit comments