Skip to content

Commit

Permalink
feat: update ip launchpad tbl
Browse files Browse the repository at this point in the history
  • Loading branch information
harisato committed Sep 5, 2024
1 parent 63664f6 commit 37f74d1
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 44 deletions.
69 changes: 37 additions & 32 deletions hasura/metadata/databases/punkga-pg/tables/public_ip_launchpad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ insert_permissions:
creator_id:
_eq: X-Hasura-User-Id
columns:
- creator_id
- id
- featured_images
- nft_images
- onchain_info
- contract_address
- created_at
- creator_address
- creator_id
- description
- end_date
- featured_images
- id
- license_info
- license_token_address
- license_token_id
- logo_url
Expand All @@ -36,13 +37,13 @@ insert_permissions:
- metadata_uri_base
- mint_price
- name
- nft_images
- onchain_info
- royalties
- start_date
- status
- thumbnail_url
- tx_hash
- created_at
- end_date
- start_date
- updated_at
select_permissions:
- role: anonymous
Expand All @@ -51,6 +52,7 @@ select_permissions:
- creator_id
- id
- featured_images
- license_info
- nft_images
- onchain_info
- contract_address
Expand Down Expand Up @@ -78,14 +80,15 @@ select_permissions:
- role: creator
permission:
columns:
- creator_id
- id
- featured_images
- nft_images
- onchain_info
- contract_address
- created_at
- creator_address
- creator_id
- description
- end_date
- featured_images
- id
- license_info
- license_token_address
- license_token_id
- logo_url
Expand All @@ -95,27 +98,28 @@ select_permissions:
- metadata_uri_base
- mint_price
- name
- nft_images
- onchain_info
- royalties
- start_date
- status
- thumbnail_url
- tx_hash
- created_at
- end_date
- start_date
- updated_at
filter: {}
allow_aggregations: true
- role: user
permission:
columns:
- creator_id
- id
- featured_images
- nft_images
- onchain_info
- contract_address
- created_at
- creator_address
- creator_id
- description
- end_date
- featured_images
- id
- license_info
- license_token_address
- license_token_id
- logo_url
Expand All @@ -125,28 +129,29 @@ select_permissions:
- metadata_uri_base
- mint_price
- name
- nft_images
- onchain_info
- royalties
- start_date
- status
- thumbnail_url
- tx_hash
- created_at
- end_date
- start_date
- updated_at
filter: {}
allow_aggregations: true
update_permissions:
- role: user
permission:
columns:
- creator_id
- id
- featured_images
- nft_images
- onchain_info
- contract_address
- created_at
- creator_address
- creator_id
- description
- end_date
- featured_images
- id
- license_info
- license_token_address
- license_token_id
- logo_url
Expand All @@ -156,13 +161,13 @@ update_permissions:
- metadata_uri_base
- mint_price
- name
- nft_images
- onchain_info
- royalties
- start_date
- status
- thumbnail_url
- tx_hash
- created_at
- end_date
- start_date
- updated_at
filter: {}
check:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."ip_launchpad" alter column "license_token_id" set not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."ip_launchpad" alter column "license_token_id" drop not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."ip_launchpad" add column "license_info" jsonb
-- null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."ip_launchpad" add column "license_info" jsonb
null;
11 changes: 7 additions & 4 deletions src/modules/ip-launchpad/dto/create-ip-launchpad-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export class CreateIPLaunchpadRequestDto {
@ApiProperty()
name: string;

@ApiProperty()
license_token_id: string;
// @ApiProperty()
// license_token_id: string;

@ApiProperty()
license_token_address: string;
// @ApiProperty()
// license_token_address: string;

@ApiProperty()
mint_price: string;
Expand Down Expand Up @@ -45,4 +45,7 @@ export class CreateIPLaunchpadRequestDto {

@ApiPropertyOptional()
creator_address: string;

@ApiPropertyOptional()
license_info: any;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export class EditDraftIpLaunchpadRequestDto {
@ApiPropertyOptional()
creator_address: string;

@ApiPropertyOptional()
license_info: any;

@ApiProperty()
thumbnail_url: string;

Expand Down
20 changes: 12 additions & 8 deletions src/modules/ip-launchpad/ip-launchpad.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class IPLaunchpadService {

const {
name,
license_token_id,
license_token_address,
// license_token_id,
// license_token_address,
mint_price,
royalties,
max_supply,
Expand All @@ -57,14 +57,15 @@ export class IPLaunchpadService {
end_date,
description,
creator_address,
license_info,
} = data;

// insert db
const result = await this.iplaunchpadGraphql.insert({
data: {
name,
license_token_id,
license_token_address,
// license_token_id,
// license_token_address,
mint_price,
royalties,
max_supply,
Expand All @@ -75,6 +76,7 @@ export class IPLaunchpadService {
creator_address,
creator_id: userId,
status: LaunchpadStatus.Draft,
license_info: JSON.parse(license_info),
},
});

Expand Down Expand Up @@ -364,7 +366,7 @@ export class IPLaunchpadService {

const {
name,
license_token_id,
// license_token_id,
mint_price,
// royalties,
max_supply,
Expand All @@ -376,7 +378,8 @@ export class IPLaunchpadService {
thumbnail_url,
featured_images_url,
nft_images_url,
license_token_address,
// license_token_address,
license_info,
} = data;

let new_thumbnail_url = thumbnail_url;
Expand Down Expand Up @@ -436,7 +439,7 @@ export class IPLaunchpadService {
id: iplaunchpadId,
data: {
name,
license_token_id,
// license_token_id,
mint_price,
// royalties,
max_supply,
Expand All @@ -446,10 +449,11 @@ export class IPLaunchpadService {
description,
creator_address,
// creator_id: userId,
license_token_address,
// license_token_address,
thumbnail_url: new_thumbnail_url,
featured_images: featured_images_url_arr,
nft_images: nft_images_url_arr,
license_info: JSON.parse(license_info),
},
});

Expand Down

0 comments on commit 37f74d1

Please sign in to comment.