New to NFT and solidity, and want to know how we can get NFTs grouped by collection type. e.g.
collections =>
[
art => [nft1, nft2, ...],
music => [nft1, nft2, ...]
]
So that users can see collections and buy a random NFT from it.
My question is, where to put that logic ? in smart contract or we have to save nfts in other database (MySql, MongoDb) where can query and categorise them on the basis of collection type ?
If I have to do this in other database e.g. MySql, MongoDb then I will listen to transfer event when an NFT is minted and save all details on database and then query to list collections on the basis of types.
Or If I add that logic in Smart Contract then I can create Collection struct and add functions to add/remove/move NFT to that collection.
What do you think one is better option to do this ?
If smart contract is better then, how I can get collections along with NFTs added in them ? should I create mapping of collections and then each Collection struct will have mapping of NFT struct ?