Skip to content

Commit

Permalink
fix: did_status_entity.document
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Nov 12, 2024
1 parent eab4911 commit f97d2a5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ___

### document

**document**: `string`
**document**: [`DIDDocumentEntity`](modules_did_did_entity.DIDDocumentEntity.md)

___

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddDidSyncStatus1731053556839 implements MigrationInterface {
name = 'AddDidSyncStatus1731053556839';
export class AddDIDSyncStatus1731403701796 implements MigrationInterface {
name = 'AddDIDSyncStatus1731403701796';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "did_document_entity" ("id" character varying NOT NULL, "service" jsonb NOT NULL, "authentication" jsonb NOT NULL, "created" character varying, "delegates" text array, "proof" jsonb, "publicKey" jsonb NOT NULL, "updated" character varying, "@context" character varying NOT NULL, "logs" character varying NOT NULL, CONSTRAINT "PK_d96048f4c93be203eeff05ef404" PRIMARY KEY ("id"))`
);
await queryRunner.query(
`CREATE TYPE "public"."did_sync_status_entity_status_enum" AS ENUM('0', '1')`
);
Expand All @@ -23,5 +26,6 @@ export class AddDidSyncStatus1731053556839 implements MigrationInterface {
await queryRunner.query(
`DROP TYPE "public"."did_sync_status_entity_status_enum"`
);
await queryRunner.query(`DROP TABLE "did_document_entity"`);
}
}
4 changes: 2 additions & 2 deletions src/modules/did/did.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class DIDService implements OnModuleInit, OnModuleDestroy {

const updated = await this.didRepository.save(updatedEntity);
await this.didSyncStatusRepository.save({
document: did,
document: updated,
status: DidSyncStatus.Synced,
});
return updated;
Expand Down Expand Up @@ -378,7 +378,7 @@ export class DIDService implements OnModuleInit, OnModuleDestroy {
await this.didSyncStatusRepository.find({
where: { status: DidSyncStatus.Stale },
})
).map((status) => status.document);
).map((status) => status.document.id);
this.logger.debug(`Beginning sync of DID Documents`);
staleDIDs.forEach(async (did) => {
this.logger.debug(`Synchronizing DID ${did}`);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/did/didSyncStatus.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class DidSyncStatusEntity {

@OneToOne(() => DIDDocumentEntity, (document) => document.id)
@JoinColumn()
document: string;
document: DIDDocumentEntity;

@Column({ enum: DidSyncStatus, type: 'enum' })
status: DidSyncStatus;
Expand Down

0 comments on commit f97d2a5

Please sign in to comment.