Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Feb 5, 2025
1 parent a7657df commit 5e7798b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/model/generated/_tokenCap.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import {TokenCapSingleMint} from "./_tokenCapSingleMint"
import {TokenCapSupply} from "./_tokenCapSupply"
import { TokenCapSingleMint } from './_tokenCapSingleMint'
import { TokenCapSupply } from './_tokenCapSupply'

export type TokenCap = TokenCapSingleMint | TokenCapSupply

export function fromJsonTokenCap(json: any): TokenCap {
switch(json?.isTypeOf) {
case 'TokenCapSingleMint': return new TokenCapSingleMint(undefined, json)
case 'TokenCapSupply': return new TokenCapSupply(undefined, json)
default: throw new TypeError('Unknown json object passed as TokenCap')
console.log(json)
switch (json?.isTypeOf) {
case 'TokenCapSingleMint':
return new TokenCapSingleMint(undefined, json)
case 'TokenCapSupply':
return new TokenCapSupply(undefined, json)
default:
throw new TypeError('Unknown json object passed as TokenCap')
}
}
6 changes: 5 additions & 1 deletion src/model/generated/token.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ export class Token {
@Column_('jsonb', {
transformer: {
to: (obj) => (obj == null ? undefined : obj.toJSON()),
from: (obj) => (obj == null ? undefined : fromJsonTokenCap(obj)),
from: (obj) => {
console.log(this.id)

Check failure on line 55 in src/model/generated/token.model.ts

View workflow job for this annotation

GitHub Actions / Check application builds (20.x)

Object is possibly 'undefined'.
console.log(obj)
return obj == null ? undefined : fromJsonTokenCap(obj)
},
},
nullable: true,
})
Expand Down

0 comments on commit 5e7798b

Please sign in to comment.