Skip to content

Commit

Permalink
fix: create schema
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
  • Loading branch information
sairanjit committed Jan 10, 2024
1 parent 2a73a18 commit 3411c91
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/schema-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class PolygonSchema {
)
}

public async createSchema(did: string, schemaName: string) {
public async createSchema(did: string, schemaName: string, schema: object) {
let schemaId
let tnxSchemaId = ''

Expand Down Expand Up @@ -110,10 +110,8 @@ export class PolygonSchema {
throw new Error(`Error while adding schema resource in DID Registry!`)
}

const uploadSchemaDetails = await this.uploadSchemaFile(
schemaId,
schemaResource,
)
const uploadSchemaDetails = await this.uploadSchemaFile(schemaId, schema)

if (!uploadSchemaDetails) {
throw new Error(`Error while uploading schema on file server!`)
}
Expand Down Expand Up @@ -177,14 +175,11 @@ export class PolygonSchema {
}
}

private async uploadSchemaFile(
schemaResourceId: string,
schemaResourcePayload: ResourcePayload,
) {
private async uploadSchemaFile(schemaResourceId: string, schema: object) {
try {
const schemaPayload = {
schemaId: `${schemaResourceId}`,
schema: schemaResourcePayload,
schema,
}

const axiosOptions = {
Expand Down

0 comments on commit 3411c91

Please sign in to comment.