2020from typing import (
2121 Any ,
2222 Dict ,
23+ Union ,
2324)
2425
26+ from app .auth import (
27+ schemas as auth_schemas ,
28+ )
2529from app .config import (
2630 settings ,
2731)
4448@router .post (
4549 "/nft/mint-offer" ,
4650 name = "nft:mint-nft-with-offer" ,
47- # response_model=Any ,
48- # responses={
49- # 201 : {
50- # "model": Any ,
51- # "description": "A response object that contains info about "
52- # " a wallet. ",
53- # },
54- # },
51+ response_model = auth_schemas . ResponseSchema ,
52+ responses = {
53+ 200 : {
54+ "model" : auth_schemas . ResponseSchema ,
55+ "description" : "A response object that indicates an nft "
56+ " has been minted successfully! " ,
57+ },
58+ },
5559)
5660async def mint_nft_token_with_offer (
5761 nft_info : nfts_schemas .NFTObjectSchema ,
5862 current_wallet : Any = Depends (jwt .get_current_active_wallet ),
5963 session : AIOSession = Depends (dependencies .get_db_transactional_session ),
6064) -> Dict [str , Any ]:
6165 """
62- Generate a faucet wallet .
66+ mint an nft token and create a sell offer .
6367 """
6468 meta_data = f"{ nft_info .picture } ,{ nft_info .title } ,{ nft_info .price } "
65- results = await nfts_crud .mint_nft_token (
69+ await nfts_crud .mint_nft_token (
6670 current_wallet .classic_address , meta_data , session , True
6771 )
68- return results
72+ return { "status_code" : 200 , "message" : "NFT minted successfully!" }
6973
7074
7175@router .post (
7276 "/nft/upload-image" ,
7377 name = "nft:upload-image" ,
74- # response_model=Any,
75- # responses={
76- # 201: {
77- # "model": Any,
78- # "description": "A response object that contains info about"
79- # " a wallet.",
80- # },
81- # },
78+ response_model = Union [
79+ auth_schemas .ResponseSchema , nfts_schemas .UploadImageResponseSchema
80+ ],
81+ responses = {
82+ 400 : {
83+ "model" : auth_schemas .ResponseSchema ,
84+ "description" : "A response object that indicates something went wrong!" ,
85+ },
86+ 200 : {
87+ "model" : nfts_schemas .UploadImageResponseSchema ,
88+ "description" : "A response object that contains an ipfs url of the image." ,
89+ },
90+ },
8291)
8392async def upload_nft_image (
8493 file : UploadFile = File (...),
@@ -108,14 +117,14 @@ async def upload_nft_image(
108117@router .post (
109118 "/nft/upload-mint-nft" ,
110119 name = "nft:upload-mint-nft" ,
111- # response_model=Any ,
112- # responses={
113- # 201 : {
114- # "model": Any ,
115- # "description": "A response object that contains info about "
116- # " a wallet. ",
117- # },
118- # },
120+ response_model = auth_schemas . ResponseSchema ,
121+ responses = {
122+ 200 : {
123+ "model" : auth_schemas . ResponseSchema ,
124+ "description" : "A response object that indicates an nft "
125+ " has been minted successfully! " ,
126+ },
127+ },
119128)
120129async def upload_nft_image_and_mint_nft (
121130 nft_info : nfts_schemas .NFTBase64ObjectSchema ,
@@ -144,14 +153,14 @@ async def upload_nft_image_and_mint_nft(
144153@router .get (
145154 "/nft/get-wallet-nfts" ,
146155 name = "nft:get-wallet-nfts" ,
147- # response_model=Any ,
148- # responses={
149- # 201 : {
150- # "model": Any,
151- # "description": "A response object that contains info about"
152- # " a wallet.",
153- # },
154- # },
156+ response_model = nfts_schemas . ResponseSchema ,
157+ responses = {
158+ 200 : {
159+ "model" : Any ,
160+ "description" : "A response object that contains info about"
161+ " a given wallet nfts ." ,
162+ },
163+ },
155164)
156165async def fetch_all_nfts (
157166 current_wallet : Any = Depends (jwt .get_current_active_wallet ),
@@ -166,14 +175,14 @@ async def fetch_all_nfts(
166175@router .get (
167176 "/nft/get-all" ,
168177 name = "nft:get-wallets-nfts" ,
169- # response_model=Any ,
170- # responses={
171- # 201 : {
172- # "model": Any ,
173- # "description": "A response object that contains info about"
174- # " a wallet .",
175- # },
176- # },
178+ response_model = nfts_schemas . ResponseSchema ,
179+ responses = {
180+ 200 : {
181+ "model" : nfts_schemas . ResponseSchema ,
182+ "description" : "A response object that contains info about"
183+ " a all nfts available on the marketplace ." ,
184+ },
185+ },
177186)
178187async def fetch_all_wallets_nfts (
179188 session : AIOSession = Depends (dependencies .get_db_transactional_session ),
0 commit comments