Skip to content

Commit

Permalink
Merge pull request #413 from credebl/conversion-id-into-uuid
Browse files Browse the repository at this point in the history
feat: conversion of id's into UUID
  • Loading branch information
nishad-ayanworks authored Nov 23, 2023
2 parents 282f173 + c33e044 commit c2a9e14
Show file tree
Hide file tree
Showing 34 changed files with 143 additions and 147 deletions.
2 changes: 1 addition & 1 deletion src/api/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { apiRoutes } from "../config/apiRoutes";
import { getFromLocalStorage } from "./Auth";
import { storageKeys } from "../config/CommonConstant";

export const getAgentHealth = async (orgId:number) => {
export const getAgentHealth = async (orgId:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.checkAgentHealth}`,
Expand Down
2 changes: 1 addition & 1 deletion src/api/BulkIssuance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const DownloadCsvTemplate = async (credDefId: string) => {
}
};

export const uploadCsvFile = async (payload: {file: Uint8Array | Blob}, credefId: string) => {
export const uploadCsvFile = async (payload: {file: Uint8Array | Blob, fileName:string}, credefId: string) => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.uploadCsv}?credDefId=${credefId}`;

Expand Down
8 changes: 4 additions & 4 deletions src/api/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const getAllSchemasByOrgId = async ({ search, itemPerPage, page }: GetAll
}
}

export const addSchema = async (payload: createSchema, orgId: number) => {
export const addSchema = async (payload: createSchema, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.create}`,
Expand All @@ -72,7 +72,7 @@ export const addSchema = async (payload: createSchema, orgId: number) => {
}
}

export const getSchemaById = async (schemaId: string, orgId: number) => {
export const getSchemaById = async (schemaId: string, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getSchemaById}/${schemaId}`,
Expand All @@ -94,7 +94,7 @@ export const getSchemaById = async (schemaId: string, orgId: number) => {
}
}

export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:number) => {
export const createCredentialDefinition = async (payload: createCredDeffFieldName, orgId:string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.createCredentialDefinition}`,
Expand All @@ -118,7 +118,7 @@ export const createCredentialDefinition = async (payload: createCredDeffFieldNam
}
}

export const getCredDeffById = async (schemaId: string, orgId: number) => {
export const getCredDeffById = async (schemaId: string, orgId: string) => {
const token = await getFromLocalStorage(storageKeys.TOKEN)
const details = {
url: `${apiRoutes.organizations.root}/${orgId}${apiRoutes.schema.getCredDefBySchemaId}/${schemaId}/cred-defs`,
Expand Down
6 changes: 3 additions & 3 deletions src/api/ecosystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface CreateEcosystemPayload {
description: string;
logo: string;
tags?: string;
userId: number;
userId: string;
autoEndorsement: boolean;
}

Expand Down Expand Up @@ -105,7 +105,7 @@ export const getEndorsementList = async (
export const createSchemaRequest = async (
data: object,
endorsementId: string,
orgId: number,
orgId: string,
) => {
const url = `${apiRoutes.Ecosystem.root}/${endorsementId}/${orgId}${apiRoutes.Ecosystem.endorsements.createSchemaRequest}`;
const payload = data;
Expand All @@ -126,7 +126,7 @@ export const createSchemaRequest = async (
export const createCredDefRequest = async (
data: object,
ecosystemId: string,
orgId: number,
orgId: string,
) => {
const url = `${apiRoutes.Ecosystem.root}/${ecosystemId}/${orgId}${apiRoutes.Ecosystem.endorsements.createCredDefRequest}`;
const payload = data;
Expand Down
10 changes: 5 additions & 5 deletions src/api/invitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const createInvitations = async (invitationList: Array<object>) => {
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.organizations.invitations}`
const payload = {
invitations: invitationList,
orgId: Number(orgId)
orgId: orgId
}
const token = await getFromLocalStorage(storageKeys.TOKEN)

Expand Down Expand Up @@ -233,7 +233,7 @@ export const getEcosystemInvitations = async (pageNumber: number, pageSize: numb
}

// Accept/ Reject Invitations
export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: number, status: string, orgName: string, orgDid: string) => {
export const acceptRejectEcosystemInvitations = async (invitationId: string, orgId: string, status: string, orgName: string, orgDid: string) => {

const url = `${apiRoutes.Ecosystem.root}/${orgId}${apiRoutes.Ecosystem.invitations}/${invitationId}`

Expand Down Expand Up @@ -265,12 +265,12 @@ export const acceptRejectEcosystemInvitations = async (invitationId: string, org
}
}

export const acceptRejectInvitations = async (invitationId: number, orgId: number, status: string) => {
export const acceptRejectInvitations = async (invitationId: string, orgId: string, status: string) => {

const url = `${apiRoutes.users.invitations}/${invitationId}`

const payload = {
orgId: Number(orgId),
orgId: orgId,
status
}
const token = await getFromLocalStorage(storageKeys.TOKEN)
Expand All @@ -296,7 +296,7 @@ export const acceptRejectInvitations = async (invitationId: number, orgId: numbe
}
}

export const deleteEcosystemInvitations = async (invitationId: number) => {
export const deleteEcosystemInvitations = async (invitationId: string) => {

const ecosystemId = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID);
const orgId = await getFromLocalStorage(storageKeys.ORG_ID)
Expand Down
8 changes: 4 additions & 4 deletions src/api/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const getOrgDashboard = async (orgId: string) => {
}
}

export const spinupDedicatedAgent = async (data: object, orgId:number) => {
export const spinupDedicatedAgent = async (data: object, orgId:string) => {

const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentDedicatedSpinup}`
const payload = data
Expand Down Expand Up @@ -166,7 +166,7 @@ export const spinupDedicatedAgent = async (data: object, orgId:number) => {
}
}

export const spinupSharedAgent = async (data: object, orgId:number) => {
export const spinupSharedAgent = async (data: object, orgId:string) => {

const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Agent.agentSharedSpinup}`
const payload = data
Expand Down Expand Up @@ -247,7 +247,7 @@ export const getOrganizationUsers = async (pageNumber: number, pageSize: number,
}

// Edit user roles
export const editOrganizationUserRole = async (userId: number, roles: number[]) => {
export const editOrganizationUserRole = async (userId: string, roles: string[]) => {

const orgId = await getFromLocalStorage(storageKeys.ORG_ID)

Expand Down Expand Up @@ -284,7 +284,7 @@ export const createConnection = async (orgName: string) => {
label: orgName,
multiUseInvitation: true,
autoAcceptConnection: true,
orgId: Number(orgId)
orgId: orgId
}
const payload = data

Expand Down
2 changes: 1 addition & 1 deletion src/commonComponents/AgentHealth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const AgentHealth = () => {
const organizationId = await getFromLocalStorage(storageKeys.ORG_ID);
setCheckOrgExist(Number(organizationId))
if (Number(organizationId) !== 0) {
const agentData = await getAgentHealth(Number(organizationId));
const agentData = await getAgentHealth(organizationId);
const { data } = agentData as AxiosResponse;
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
setAgentHealthDetails(data?.data);
Expand Down
6 changes: 3 additions & 3 deletions src/components/CreateEcosystemOrgModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
storageKeys,
} from '../../config/CommonConstant';
import { calculateSize, dataURItoBlob } from '../../utils/CompressImage';
import { useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { AlertComponent } from '../AlertComponent';
import type { AxiosResponse } from 'axios';
import { asset } from '../../lib/data.js';
Expand Down Expand Up @@ -186,7 +186,7 @@ const CreateEcosystemOrgModal = (props: IProps) => {
description: values.description,
logo: (logoImage?.imagePreviewUrl as string) || '',
tags: '',
userId: Number(user_data?.id),
userId: user_data?.id,
orgName: orgDetails?.orgName,
orgDid: orgDetails?.orgDid,
autoEndorsement: autoEndorse,
Expand Down Expand Up @@ -516,4 +516,4 @@ const CreateEcosystemOrgModal = (props: IProps) => {
return <>{renderEcosystemModal()}</>;
};

export default CreateEcosystemOrgModal;
export default CreateEcosystemOrgModal;
2 changes: 1 addition & 1 deletion src/components/Ecosystem/Endorsement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface IEndorsementList {
status: string;
type: string;
ecosystemOrgs: {
orgId: number;
orgId: string;
};
requestPayload: string;
responsePayload: string;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Ecosystem/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export interface IEcosystem {
}

export interface Ecosystem {
id: number
id: string
createDateTime: string
createdBy: number
createdBy: string
lastChangedDateTime: string
lastChangedBy: string
autoEndorsement:boolean
lastChangedBy: number
name: string
description: string
logoUrl: string
Expand Down
10 changes: 5 additions & 5 deletions src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export interface EcosystemInvitation {
ecosystem: { name: string; logoUrl: string; };
id: string
createDateTime: string
createdBy: number
createdBy: string
lastChangedDateTime: string
lastChangedBy: number
lastChangedBy: string
deletedAt: any
userId: string
orgId: string
Expand All @@ -60,7 +60,7 @@ const ReceivedInvitations = () => {
const [error, setError] = useState<string | null>(null);
const [organizationsList, setOrganizationsList] = useState<Array<Organisation> | null>(null);
const [currentPage, setCurrentPage] = useState(initialPageState);
const [selectedId, setSelectedId] = useState<number>();
const [selectedId, setSelectedId] = useState<string>('');
const [searchText, setSearchText] = useState('');
const [invitationsData, setInvitationsData] = useState<Array<EcosystemInvitation> | null>(null);
const [getOrgError, setGetOrgError] = useState<string | null>(null);
Expand Down Expand Up @@ -154,7 +154,7 @@ const ReceivedInvitations = () => {
if (orgDid) {
const response = await acceptRejectEcosystemInvitations(
invite.id,
Number(selectedId),
selectedId,
status,
orgName,
orgDid
Expand Down Expand Up @@ -222,7 +222,7 @@ const ReceivedInvitations = () => {
const getOrgId = async () => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
if (orgId) {
setSelectedId(Number(orgId));
setSelectedId(orgId);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/EcosystemInvite/SentInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const SentInvitations = () => {
setLoading(false);
};

const deletInvitations = async (invitationId: number) => {
const deletInvitations = async (invitationId: string) => {
const response = await deleteEcosystemInvitations(invitationId);
const { data } = response as AxiosResponse;

Expand Down
4 changes: 3 additions & 1 deletion src/components/Issuance/BulkIssuance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ const BulkIssuance = () => {
await setToLocalStorage(storageKeys.SOCKET_ID, clientId)
const payload = {
file: binaryData,
fileName: file?.name || "Not available"
};

await wait(500);
Expand Down Expand Up @@ -305,6 +306,7 @@ const BulkIssuance = () => {
setIsFileUploaded(false);
setUploadedFileName('');
setUploadedFile(null);
setUploadMessage(null)
};

const handleDrop = (e: {
Expand Down Expand Up @@ -447,7 +449,7 @@ const BulkIssuance = () => {
<div className="flex flex-col justify-between min-h-100/21rem">
<Card>
<div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
<div className="flex flex-col justify-between">
<div className="search-dropdown text-primary-700 drak:text-primary-700">
<Select
Expand Down
47 changes: 24 additions & 23 deletions src/components/Issuance/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ const HistoryBulkIssuance = () => {

useEffect(() => {
SOCKET.emit('bulk-connection');
SOCKET.on('bulk-issuance-process-completed', () => {
console.log(`bulk-issuance-process-completed`);
toast.success('Issuance process completed.', {
SOCKET.on('bulk-issuance-process-retry-completed', () => {
console.log(`bulk-issuance-process-retry-completed`);
toast.success('Issuance process completed', {
position: 'top-right',
autoClose: 5000,
autoClose: 3000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: 'colored',
});
setSuccess('Bulk issuance process completed.');
setSuccess('Issuance process completed');
});

SOCKET.on('error-in-bulk-issuance-process', () => {
SOCKET.on('error-in-bulk-issuance-retry-process', () => {
console.log(`error-in-bulk-issuance-retry-process-initiated`);
toast.error('Issuance process failed. Please retry', {
position: 'top-right',
Expand Down Expand Up @@ -171,28 +171,27 @@ const HistoryBulkIssuance = () => {
{
data: (
<p
className={`${
status === BulkIssuanceHistory.started
? 'bg-primary-100 text-primary-800 dark:bg-gray-700 dark:text-primary-400 border border-primary-100 dark:border-primary-500'
: status === BulkIssuanceHistory.completed ||
status === BulkIssuanceHistory.retry
className={`${status === BulkIssuanceHistory.started
? 'bg-primary-100 text-primary-800 dark:bg-gray-700 dark:text-primary-400 border border-primary-100 dark:border-primary-500'
: status === BulkIssuanceHistory.completed ||
status === BulkIssuanceHistory.retry
? 'bg-green-100 text-green-800 dark:bg-gray-700 dark:text-green-400 border border-green-100 dark:border-green-500'
: status === BulkIssuanceHistory.interrupted
? 'bg-orange-100 text-orange-800 dark:bg-gray-700 dark:text-orange-400 border border-orange-100 dark:border-orange-400'
: status === BulkIssuanceHistory.partially_completed
? 'bg-red-100 text-red-800 dark:bg-gray-700 dark:text-red-400 border border-red-100 dark:border-red-500'
: 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400 border border-gray-100 dark:border-gray-500'
} text-sm font-medium mr-0.5 px-0.5 py-0.5 rounded-md flex justify-center items-center max-w-[180px]`}
? 'bg-orange-100 text-orange-800 dark:bg-gray-700 dark:text-orange-400 border border-orange-100 dark:border-orange-400'
: status === BulkIssuanceHistory.partially_completed
? 'bg-red-100 text-red-800 dark:bg-gray-700 dark:text-red-400 border border-red-100 dark:border-red-500'
: 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400 border border-gray-100 dark:border-gray-500'
} text-sm font-medium mr-0.5 px-0.5 py-0.5 rounded-md flex justify-center items-center w-fit px-2`}
>
{status === BulkIssuanceHistory.started
? BulkIssuanceHistoryData.started
: status === BulkIssuanceHistory.completed
? BulkIssuanceHistoryData.completed
: status === BulkIssuanceHistory.interrupted
? BulkIssuanceHistoryData.interrupted
: status === BulkIssuanceHistory.partially_completed
? BulkIssuanceHistoryData.partially_completed
: BulkIssuanceHistoryData.retry}
? BulkIssuanceHistoryData.completed
: status === BulkIssuanceHistory.interrupted
? BulkIssuanceHistoryData.interrupted
: status === BulkIssuanceHistory.partially_completed
? BulkIssuanceHistoryData.partially_completed
: BulkIssuanceHistoryData.retry}
</p>
),
},
Expand Down Expand Up @@ -271,7 +270,9 @@ const HistoryBulkIssuance = () => {
total: totalPages,
});
} else {
setFailure(response as string);
if (response?.toString()?.toLowerCase() !== "history not found") {
setFailure(response as string);
}
}
setLoading(false);
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/Issuance/HistoryDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ const HistoryDetails = ({ requestId }: IProps) => {
},
{
data: (
<span
<p
className={`${
history?.isError === false
? 'bg-green-100 text-green-800 dark:bg-gray-700 dark:text-green-400 border border-green-100 dark:border-green-500'
: 'bg-red-100 text-red-800 border border-red-100 dark:border-red-400 dark:bg-gray-700 dark:text-red-400'
} text-md font-medium sm:mr-0 md:mr-2 min-[320]:px-3 sm:px-3 lg:px-3 py-0.5 rounded-md flex justify-center min-[320]:w-full md:w-1/3`}
} text-md font-medium sm:mr-0 md:mr-2 px-2 min-[320]:px-3 sm:px-3 lg:px-3 py-0.5 rounded-md flex justify-center w-fit`}
>
{history?.isError === false ? BulkIssuanceStatus.successful : BulkIssuanceStatus.failed}
</span>
</p>
),
},
{
Expand Down
Loading

0 comments on commit c2a9e14

Please sign in to comment.