From f18c913145bc95edad70048cb1af7b58a54e24b5 Mon Sep 17 00:00:00 2001 From: Siddharth9890 Date: Wed, 11 Sep 2024 10:54:08 +0530 Subject: [PATCH] fix: removed model prefix from types --- scripts/generate-types.ts | 4 +++- src/common/types.ts | 47 ++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/scripts/generate-types.ts b/scripts/generate-types.ts index c59cd04..8987993 100644 --- a/scripts/generate-types.ts +++ b/scripts/generate-types.ts @@ -15,7 +15,9 @@ const getJSONSchema = async () => { }; function toPascalCase(str: string): string { - return str + const cleanedStr = str.replace(/^model\./, ''); + console.log(str); + return cleanedStr .replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) { return index === 0 ? match.toUpperCase() : match.toUpperCase(); }) diff --git a/src/common/types.ts b/src/common/types.ts index 7af1928..87e44ea 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -41,35 +41,35 @@ export type HelperPaginatedResponse = { meta?: HelperMeta; }; -export type ModelACLRequest = { address?: string; roles?: ModelAccessLevel[] }; +export type ACLRequest = { address: string; roles: AccessLevel[] }; -export type ModelAccessLevel = 'view' | 'update' | 'delete' | 'share'; +export type AccessLevel = 'view' | 'update' | 'delete' | 'share'; -export type ModelAccountCreateRequest = { +export type AccountCreateRequest = { message: string; signature: string; username: string; wallet_address: string; }; -export type ModelAuthRequest = { +export type AuthRequest = { message: string; signature: string; wallet_address: string; }; -export type ModelCreateDataAssetRequest = { - acl?: ModelACLRequest[]; +export type CreateDataAssetRequest = { + acl?: ACLRequest[]; claim?: {}; data_model_id?: number; expiration_date?: string; - name?: string; + name: string; tags?: string[]; }; -export type ModelDataAssetIDRequestAndResponse = { id?: number }; +export type DataAssetIDRequestAndResponse = { id?: number }; -export type ModelDataModel = { +export type DataModel = { created_at?: string; created_by?: string; deleted_at?: string; @@ -81,9 +81,18 @@ export type ModelDataModel = { updated_at?: string; }; -export type ModelMessageResponse = { message?: string }; +export type DataModelRequest = { + description: string; + schema: {}; + tags?: string[]; + title: string; +}; + +export type MessageResponse = { message?: string }; + +export type Metadata = { key?: string; value?: string }; -export type ModelMyAccountResponse = { +export type MyAccountResponse = { created_at?: string; did?: string; profile_picture?: string; @@ -92,7 +101,7 @@ export type ModelMyAccountResponse = { wallet_address?: string; }; -export type ModelPublicACL = { +export type PublicACL = { address?: string; created_at?: string; data_asset_id?: number; @@ -101,8 +110,8 @@ export type ModelPublicACL = { updated_at?: string; }; -export type ModelPublicDataAsset = { - acl?: ModelPublicACL[]; +export type PublicDataAsset = { + acl?: PublicACL[]; created_at?: string; created_by?: string; data_model_id?: number; @@ -117,8 +126,14 @@ export type ModelPublicDataAsset = { updated_at?: string; }; -export type ModelTokenResponse = { token?: string }; +export type TokenResponse = { token?: string }; + +export type UpdateDataAssetRequest = { + claim?: {}; + expiration_date?: string; + name?: string; +}; -export type ModelUpdateDataAssetRequest = {}; +export type ResponsesActionResponse = { message?: string }; export type ResponsesEntityRemovedResponse = { message?: string };