11import { Body , Controller , Get , Param , Post } from '@nestjs/common' ;
22import { ApiGoneResponse , ApiOkResponse , ApiOperation , ApiParam , ApiTags } from '@nestjs/swagger' ;
3+ import { NftCollection } from '@polymeshassociation/polymesh-sdk/types' ;
34
45import { AssetParamsDto } from '~/assets/dto/asset-params.dto' ;
6+ import { CreatedNftCollectionModel } from '~/assets/models/created-nft-collection.model' ;
57import { ApiArrayResponse , ApiTransactionResponse } from '~/common/decorators/' ;
68import { TransactionQueueModel } from '~/common/models/transaction-queue.model' ;
7- import { handleServiceResult , TransactionResponseModel } from '~/common/utils' ;
9+ import { handleServiceResult , TransactionResolver , TransactionResponseModel } from '~/common/utils' ;
810import { CreateNftCollectionDto } from '~/nfts/dto/create-nft-collection.dto' ;
911import { IssueNftDto } from '~/nfts/dto/issue-nft.dto' ;
1012import { NftParamsDto } from '~/nfts/dto/nft-params.dto' ;
@@ -70,7 +72,7 @@ export class NftsController {
7072 description : 'This endpoint allows for the creation of NFT collections' ,
7173 } )
7274 @ApiTransactionResponse ( {
73- description : 'Details about the transaction' ,
75+ description : 'Details about the transaction along with newly created nft collection ' ,
7476 type : TransactionQueueModel ,
7577 } )
7678 @ApiGoneResponse ( {
@@ -82,7 +84,18 @@ export class NftsController {
8284 ) : Promise < TransactionResponseModel > {
8385 const result = await this . nftService . createNftCollection ( params ) ;
8486
85- return handleServiceResult ( result ) ;
87+ const resolver : TransactionResolver < NftCollection > = ( {
88+ result : collection ,
89+ transactions,
90+ details,
91+ } ) =>
92+ new CreatedNftCollectionModel ( {
93+ collection,
94+ transactions,
95+ details,
96+ } ) ;
97+
98+ return handleServiceResult ( result , resolver ) ;
8699 }
87100
88101 @ApiOperation ( {
0 commit comments