Refacto: folder-based anchoring (#6)
This commit is contained in:
commit
1766dd3ac4
4
src/Admin/OfficeFolderAnchor.ts
Normal file
4
src/Admin/OfficeFolderAnchor.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from "../Notary/OfficeFolderAnchor";
|
||||
import OfficeFolderAnchor from "../Notary/OfficeFolderAnchor";
|
||||
|
||||
export default OfficeFolderAnchor;
|
@ -49,6 +49,5 @@ export enum EDocumentStatus {
|
||||
ASKED = "ASKED",
|
||||
DEPOSITED = "DEPOSITED",
|
||||
VALIDATED = "VALIDATED",
|
||||
ANCHORED = "ANCHORED",
|
||||
REFUSED = "REFUSED",
|
||||
}
|
||||
|
@ -22,6 +22,9 @@ export default class File extends Resource {
|
||||
@Expose()
|
||||
public mimetype!: string;
|
||||
|
||||
@Expose()
|
||||
public hash!: string;
|
||||
|
||||
@Expose()
|
||||
public size!: number;
|
||||
|
||||
|
9
src/Notary/EAnchoringStatus.ts
Normal file
9
src/Notary/EAnchoringStatus.ts
Normal file
@ -0,0 +1,9 @@
|
||||
enum EAnchoringStatus {
|
||||
QUEUED = "QUEUED",
|
||||
ATTEMPTING = "ATTEMPTING",
|
||||
VERIFIED_ON_CHAIN = "VERIFIED_ON_CHAIN",
|
||||
VERIFYING_ON_CHAIN = "VERIFYING_ON_CHAIN",
|
||||
ABANDONED = "ABANDONED",
|
||||
}
|
||||
|
||||
export default EAnchoringStatus;
|
5
src/Notary/EBlockchainName.ts
Normal file
5
src/Notary/EBlockchainName.ts
Normal file
@ -0,0 +1,5 @@
|
||||
enum EBlockchainName{
|
||||
TEZOS = "TEZOS",
|
||||
}
|
||||
|
||||
export default EBlockchainName;
|
@ -8,6 +8,8 @@ import Customer from "./Customer";
|
||||
import Document from "./Document";
|
||||
import Office from "./Office";
|
||||
import EFolderStatus from "../Customer/EFolderStatus";
|
||||
import EAnchoringStatus from "./EAnchoringStatus";
|
||||
import OfficeFolderAnchor from "./OfficeFolderAnchor";
|
||||
|
||||
export default class OfficeFolder extends OfficeFolderCustomer {
|
||||
@Expose()
|
||||
@ -68,4 +70,10 @@ export default class OfficeFolder extends OfficeFolderCustomer {
|
||||
@ValidateNested({ groups: ["updateFolder"] })
|
||||
@Type(() => Document)
|
||||
documents?: Document[];
|
||||
|
||||
@Expose()
|
||||
@IsOptional({ groups: ["updateFolder"] })
|
||||
@ValidateNested({ groups: ["updateFolder"] })
|
||||
@Type(() => Document)
|
||||
anchor?: OfficeFolderAnchor | null = null;
|
||||
}
|
||||
|
51
src/Notary/OfficeFolderAnchor.ts
Normal file
51
src/Notary/OfficeFolderAnchor.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import Resource from "../Resource";
|
||||
import { Expose, Type } from "class-transformer";
|
||||
import EBlockchainName from "./EBlockchainName";
|
||||
import EAnchoringStatus from "./EAnchoringStatus";
|
||||
import OfficeFolder from "./OfficeFolder";
|
||||
import { IsDate } from "class-validator";
|
||||
|
||||
export default class OfficeFolderAnchor extends Resource {
|
||||
@Expose()
|
||||
public uid?: string;
|
||||
|
||||
@Expose()
|
||||
public hash_sources?: string[];
|
||||
|
||||
@Expose()
|
||||
public root_hash?: string;
|
||||
|
||||
@Expose()
|
||||
public blockchain?: EBlockchainName | string = EBlockchainName.TEZOS;
|
||||
|
||||
@Expose()
|
||||
public status?: EAnchoringStatus | string = EAnchoringStatus.QUEUED;
|
||||
|
||||
@Expose()
|
||||
public anchor_nb_try?: number = 0;
|
||||
|
||||
@Expose()
|
||||
public tx_id?: string;
|
||||
|
||||
@Expose()
|
||||
public tx_link?: string;
|
||||
|
||||
@Expose()
|
||||
public tx_hash?: string;
|
||||
|
||||
@Expose()
|
||||
@Type(() => OfficeFolder)
|
||||
public folder?: OfficeFolder | null = null;
|
||||
|
||||
@Expose()
|
||||
@IsDate()
|
||||
public anchored_at?: Date | null = null;
|
||||
|
||||
@Expose()
|
||||
@IsDate()
|
||||
public created_at?: Date | null = null;
|
||||
|
||||
@Expose()
|
||||
@IsDate()
|
||||
public updated_at?: Date | null = null;
|
||||
}
|
4
src/SuperAdmin/OfficeFolderAnchor.ts
Normal file
4
src/SuperAdmin/OfficeFolderAnchor.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from "../Admin/OfficeFolderAnchor";
|
||||
import OfficeFolderAnchor from "../Admin/OfficeFolderAnchor";
|
||||
|
||||
export default OfficeFolderAnchor;
|
Loading…
x
Reference in New Issue
Block a user