@@ -15,7 +15,9 @@ use crate::{
15
15
} ;
16
16
use indexmap:: IndexMap ;
17
17
use mpl_token_metadata:: accounts:: { Edition , MasterEdition } ;
18
- use sea_orm:: { entity:: * , query:: * , sea_query:: Expr , ConnectionTrait , DbErr , Order } ;
18
+ use sea_orm:: {
19
+ entity:: * , prelude:: Decimal , query:: * , sea_query:: Expr , ConnectionTrait , DbErr , Order ,
20
+ } ;
19
21
use serde:: de:: DeserializeOwned ;
20
22
use serde_json:: Value ;
21
23
use solana_sdk:: pubkey:: Pubkey ;
@@ -433,14 +435,10 @@ pub async fn get_assets_by_condition(
433
435
pub async fn get_by_id (
434
436
conn : & impl ConnectionTrait ,
435
437
asset_id : Vec < u8 > ,
436
- include_no_supply : bool ,
437
438
options : & Options ,
438
439
) -> Result < FullAsset , DbErr > {
439
- let mut asset_data =
440
+ let asset_data =
440
441
asset:: Entity :: find_by_id ( asset_id. clone ( ) ) . find_also_related ( asset_data:: Entity ) ;
441
- if !include_no_supply {
442
- asset_data = asset_data. filter ( Condition :: all ( ) . add ( asset:: Column :: Supply . gt ( 0 ) ) ) ;
443
- }
444
442
445
443
let inscription = if options. show_inscription {
446
444
get_inscription_by_mint ( conn, asset_id. clone ( ) ) . await . ok ( )
@@ -463,6 +461,10 @@ pub async fn get_by_id(
463
461
_ => Err ( DbErr :: RecordNotFound ( "Asset Not Found" . to_string ( ) ) ) ,
464
462
} ) ?;
465
463
464
+ if asset. supply == Decimal :: from ( 0 ) {
465
+ return Err ( DbErr :: Custom ( "Asset has no supply" . to_string ( ) ) ) ;
466
+ }
467
+
466
468
let authorities: Vec < asset_authority:: Model > = asset_authority:: Entity :: find ( )
467
469
. filter ( asset_authority:: Column :: AssetId . eq ( asset. id . clone ( ) ) )
468
470
. order_by_asc ( asset_authority:: Column :: AssetId )
0 commit comments