Skip to content

Commit

Permalink
Merge pull request #20 from SSSC-DUT-Core/feat/mintcNFT-flow
Browse files Browse the repository at this point in the history
feat: update return type for mintCNFT
  • Loading branch information
minhbear authored Oct 21, 2023
2 parents bc70553 + d7559d9 commit b8e6686
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ type Mutation {
getMe: PersonEntity!
createCollection(input: CreateCollectionNFTDto!): ReturnMessageBase!
createCompressedNFTMetadata(input: CreateCompressedNFTMetadata!): ReturnMessageBase!
mintCompressedNFT(cNFTId: ID!): ReturnMessageBase!
mintCompressedNFT(cNFTId: ID!): FilmCompressedNFTEntity!
subscribeToWhitelist(filmId: ID!): ReturnMessageBase!
createFilm(input: CreateFilmDto!): ReturnMessageBase!

Expand Down
5 changes: 3 additions & 2 deletions src/user/user.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import { Person } from '@/common/decorators/person.decorator'
import { PersonEntity } from '@/db/entities/person'
import { AuthKylan } from '@/common/decorators/auth.decorator'
import { ROLE } from '@/common/constant'
import { FilmCompressedNFTEntity } from '@/db/entities/filmCompressedNFT'

@Resolver()
export class UserResolver {
constructor(private readonly userService: UserService) {}

@AuthKylan([ROLE.USER])
@Mutation(() => ReturnMessageBase)
@Mutation(() => FilmCompressedNFTEntity)
async mintCompressedNFT(
@Args('cNFTId', { type: () => ID }) cNFTId: number,
@Person() person: PersonEntity
): Promise<ReturnMessageBase> {
): Promise<FilmCompressedNFTEntity> {
return await this.userService.mintCompressedNFT(cNFTId, person)
}

Expand Down
9 changes: 3 additions & 6 deletions src/user/user.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReturnMessageBase } from '@/common/interface/returnBase'
import { Message } from '@/common/message'
import { config } from '@/config'
import { FilmCompressedNFTEntity } from '@/db/entities/filmCompressedNFT'
import { PersonEntity } from '@/db/entities/person'
import { WhitelistEntity } from '@/db/entities/whitelist'
import { GetFilmCollectionNFTCommand } from '@/film-collection-nft/commands/getFilmCollectionNFT.command'
Expand All @@ -21,8 +22,7 @@ export class UserService {
private readonly whiteListRepository: Repository<WhitelistEntity>
) {}

async mintCompressedNFT(cNFTId: number, person: PersonEntity): Promise<ReturnMessageBase> {
console.log(person);
async mintCompressedNFT(cNFTId: number, person: PersonEntity): Promise<FilmCompressedNFTEntity> {
if (!person.publicKey) {
throw new BadRequestException(Message.User.NOT_FOUND_PUBLICKEY)
}
Expand Down Expand Up @@ -55,10 +55,7 @@ export class UserService {
filmCollectionNFT
})

return {
success: true,
message: 'mint cNFT successfully'
}
return filmCompressedNFT
}

async subscribeToWhitelist(filmId: number, person: PersonEntity): Promise<ReturnMessageBase> {
Expand Down

0 comments on commit b8e6686

Please sign in to comment.