Skip to content

Commit

Permalink
Fix lint/type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Feb 19, 2024
1 parent 2336a72 commit 72d4490
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
5 changes: 4 additions & 1 deletion backend/src/ee/services/audit-log/audit-log-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type TListProjectAuditLogDTO = {

export type TCreateAuditLogDTO = {
event: Event;
actor: UserActor | IdentityActor | ServiceActor;
actor: UserActor | IdentityActor | ServiceActor | ScimClientActor;
orgId?: string;
projectId?: string;
} & BaseAuthData;
Expand Down Expand Up @@ -105,6 +105,8 @@ interface IdentityActorMetadata {
name: string;
}

interface ScimClientActorMetadata {}

export interface UserActor {
type: ActorType.USER;
metadata: UserActorMetadata;
Expand All @@ -122,6 +124,7 @@ export interface IdentityActor {

export interface ScimClientActor {
type: ActorType.SCIM_CLIENT;
metadata: ScimClientActorMetadata;
}

export type Actor = UserActor | ServiceActor | IdentityActor | ScimClientActor;
Expand Down
3 changes: 2 additions & 1 deletion backend/src/server/plugins/audit-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export const injectAuditLogInfo = fp(async (server: FastifyZodProvider) => {
};
} else if (req.auth.actor === ActorType.SCIM_CLIENT) {
payload.actor = {
type: ActorType.SCIM_CLIENT
type: ActorType.SCIM_CLIENT,
metadata: {}
};
} else {
throw new BadRequestError({ message: "Missing logic for other actor" });
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/hooks/api/scim/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { useGetScimTokens } from "./queries";
export {
useCreateScimToken,
useDeleteScimToken
} from "./mutations";
} from "./mutations";
export { useGetScimTokens } from "./queries";
9 changes: 4 additions & 5 deletions frontend/src/hooks/api/scim/mutations.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";

import { apiRequest } from "@app/config/request";

import { scimKeys } from "./queries";
import {
CreateScimTokenDTO,
CreateScimTokenRes,
DeleteScimTokenDTO
} from "./types";
import { scimKeys } from "./queries";

export const useCreateScimToken = () => {
const queryClient = useQueryClient();
Expand All @@ -32,10 +34,7 @@ export const useCreateScimToken = () => {
export const useDeleteScimToken = () => {
const queryClient = useQueryClient();
return useMutation<CreateScimTokenRes, {}, DeleteScimTokenDTO>({
mutationFn: async ({
organizationId,
scimTokenId
}) => {
mutationFn: async ({ scimTokenId }) => {
const { data } = await apiRequest.delete(`/api/v1/scim/scim-tokens/${scimTokenId}`);
return data;
},
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/hooks/api/scim/queries.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useQuery } from "@tanstack/react-query";

import { apiRequest } from "@app/config/request";

import { ScimTokenData } from "./types";

export const scimKeys = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
import { withPermission } from "@app/hoc";

import { OrgScimSection } from "./OrgScimSection";
import { OrgGeneralAuthSection } from "./OrgGeneralAuthSection";
import { OrgScimSection } from "./OrgSCIMSection";
import { OrgSSOSection } from "./OrgSSOSection";

export const OrgAuthTab = withPermission(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import {
THead,
Tr
} from "@app/components/v2";
import { useOrganization } from "@app/context";
import { useToggle } from "@app/hooks";
import {
useGetScimTokens,
useCreateScimToken,
useDeleteScimToken
} from "@app/hooks/api";
useDeleteScimToken,
useGetScimTokens} from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { useOrganization } from "@app/context";

const schema = yup.object({
description: yup.string(),
Expand Down Expand Up @@ -162,7 +161,7 @@ export const ScimTokenModal = ({
setToken("");
}}
>
<ModalContent title={`Manage SCIM credentials`}>
<ModalContent title="Manage SCIM credentials">
<h2 className="mb-4">SCIM URL</h2>
<div className="mb-8 flex items-center justify-between rounded-md bg-white/[0.07] p-2 text-base text-gray-400">
<p className="mr-4 break-all">{scimUrl}</p>
Expand Down Expand Up @@ -326,7 +325,7 @@ export const ScimTokenModal = ({
</TableContainer>
<DeleteActionModal
isOpen={popUp.deleteScimToken.isOpen}
title={"Are you sure want to delete the SCIM token?"}
title="Are you sure want to delete the SCIM token?"
onChange={(isOpen) => handlePopUpToggle("scimToken", isOpen)}
deleteKey="confirm"
onDeleteApproved={() => {
Expand Down

0 comments on commit 72d4490

Please sign in to comment.