refactor anchoring to be OfficeFolder
based
This commit is contained in:
parent
ee0656b5a7
commit
f09a300010
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;
|
@ -11,36 +11,36 @@ export default class Office extends OfficeCustomer{
|
||||
@Expose()
|
||||
@IsNotEmpty({ groups: ["createFolder" , "createDeedType" , "createDocumentType", "createRule", "createRole"] ,message: "UID is required" })
|
||||
public override uid?: string;
|
||||
|
||||
|
||||
@Expose()
|
||||
@IsNotEmpty({ groups: ["createOffice"], message: "ID IdNote is required" })
|
||||
public idNot?: string;
|
||||
|
||||
|
||||
@Expose()
|
||||
@IsNotEmpty({ groups: ["createOffice"], message: "Name is required" })
|
||||
public override name!: string;
|
||||
|
||||
|
||||
@Expose()
|
||||
@IsNotEmpty({ groups: ["createOffice"], message: "CRPCEN is required" })
|
||||
public override crpcen!: string;
|
||||
|
||||
|
||||
@Expose()
|
||||
@IsNotEmpty({ groups: ["createOffice"], message: "Address is required" })
|
||||
@ValidateNested({ groups: ["createOffice"] })
|
||||
@Type(() => Address)
|
||||
public override address?: Address;
|
||||
|
||||
|
||||
@Expose()
|
||||
public office_status?: EOfficeStatus | string;
|
||||
|
||||
|
||||
@Expose()
|
||||
@Type(() => DeedType)
|
||||
public deed_types?: DeedType[];
|
||||
|
||||
|
||||
@Expose()
|
||||
@Type(() => User)
|
||||
public users?: User[];
|
||||
|
||||
|
||||
@Expose()
|
||||
@Type(() => OfficeFolder)
|
||||
public office_folders?: OfficeFolder[];
|
||||
@ -49,4 +49,4 @@ export default class Office extends OfficeCustomer{
|
||||
export enum EOfficeStatus {
|
||||
ACTIVATED = "ACTIVATED",
|
||||
DESACTIVATED = "DESACTIVATED",
|
||||
}
|
||||
}
|
||||
|
@ -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