Skip to content

Commit

Permalink
fix: removed model prefix from types
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Sep 11, 2024
1 parent 52f62c2 commit f18c913
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
4 changes: 3 additions & 1 deletion scripts/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
Expand Down
47 changes: 31 additions & 16 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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 };

0 comments on commit f18c913

Please sign in to comment.