feat: implemented ui and api for managing user,identity metadata

This commit is contained in:
=
2024-10-02 00:39:43 +05:30
parent 15c98a1d2e
commit 77e191d63e
24 changed files with 570 additions and 92 deletions
@@ -67,12 +67,13 @@ export const useCreateIdentity = () => {
export const useUpdateIdentity = () => {
const queryClient = useQueryClient();
return useMutation<Identity, {}, UpdateIdentityDTO>({
mutationFn: async ({ identityId, name, role }) => {
mutationFn: async ({ identityId, name, role, metadata }) => {
const {
data: { identity }
} = await apiRequest.patch(`/api/v1/identities/${identityId}`, {
name,
role
role,
metadata
});
return identity;
@@ -37,6 +37,7 @@ export type IdentityMembershipOrg = {
id: string;
identity: Identity;
organization: string;
metadata: { key: string; value: string; id: string }[];
role: "admin" | "member" | "viewer" | "no-access" | "custom";
customRole?: TOrgRole;
createdAt: string;
@@ -79,6 +80,7 @@ export type CreateIdentityDTO = {
name: string;
organizationId: string;
role?: string;
metadata?: { key: string; value: string }[];
};
export type UpdateIdentityDTO = {
@@ -86,6 +88,7 @@ export type UpdateIdentityDTO = {
name?: string;
role?: string;
organizationId: string;
metadata?: { key: string; value: string }[];
};
export type DeleteIdentityDTO = {
+3 -2
View File
@@ -235,12 +235,13 @@ export const useUpdateOrgMembership = () => {
const queryClient = useQueryClient();
return useMutation<{}, {}, UpdateOrgMembershipDTO>({
mutationFn: ({ organizationId, membershipId, role, isActive }) => {
mutationFn: ({ organizationId, membershipId, role, isActive, metadata }) => {
return apiRequest.patch(
`/api/v2/organizations/${organizationId}/memberships/${membershipId}`,
{
role,
isActive
isActive,
metadata
}
);
},
+2
View File
@@ -46,6 +46,7 @@ export type UserEnc = {
export type OrgUser = {
id: string;
metadata: { key: string; value: string; id: string }[];
user: {
username: string;
email?: string;
@@ -142,6 +143,7 @@ export type UpdateOrgMembershipDTO = {
membershipId: string;
role?: string;
isActive?: boolean;
metadata?: { key: string; value: string }[];
};
export type DeletOrgMembershipDTO = {