Skip to content

Commit

Permalink
fix: corrected a spelling mistake in word Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Troff8 committed Sep 22, 2023
1 parent 83edb3e commit 57f83d0
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/components/GoalCreateForm/GoalCreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const GoalCreateForm: React.FC<GoalCreateFormProps> = ({ title, onGoalCreate })
return (
<GoalForm
busy={busy}
validityScheme={goalCommonSchema}
validitySchema={goalCommonSchema}
owner={{ id: user?.activityId, user } as ActivityByIdReturnType}
parent={currentProjectCache || lastProjectCache || undefined}
priority="Medium"
Expand Down
20 changes: 10 additions & 10 deletions src/components/GoalCriteria/GoalCriteria.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { backgroundColor, brandColor, gray10, danger0, gray8, gray9, gray4, text
import NextLink from 'next/link';

import {
AddCriteriaScheme,
RemoveCriteriaScheme,
UpdateCriteriaScheme,
UpdateCriteriaStateScheme,
AddCriteriaSchema,
RemoveCriteriaSchema,
UpdateCriteriaSchema,
UpdateCriteriaStateSchema,
} from '../../schema/criteria';
import { Title } from '../Table';
import { GoalAchiveCriteria } from '../../../trpc/inferredTypes';
Expand Down Expand Up @@ -295,14 +295,14 @@ interface GoalCriteriaProps {
criteriaList?: GoalAchiveCriteria[];
canEdit: boolean;
onClick?: (item: GoalAchiveCriteria) => void;
onAddCriteria: (val: AddCriteriaScheme) => void;
onToggleCriteria: (val: UpdateCriteriaStateScheme) => void;
onRemoveCriteria: (val: RemoveCriteriaScheme) => void;
onAddCriteria: (val: AddCriteriaSchema) => void;
onToggleCriteria: (val: UpdateCriteriaStateSchema) => void;
onRemoveCriteria: (val: RemoveCriteriaSchema) => void;
onConvertToGoal: (val: GoalAchiveCriteria) => void;
onUpdateCriteria: (val: UpdateCriteriaScheme) => void;
onUpdateCriteria: (val: UpdateCriteriaSchema) => void;
renderTrigger?: (obj: {
goalId: string;
onSubmit: (val: AddCriteriaScheme) => void;
onSubmit: (val: AddCriteriaSchema) => void;
validityData: { sum: number; title: string[] };
}) => ReactNode;
}
Expand All @@ -326,7 +326,7 @@ export const GoalCriteria: React.FC<GoalCriteriaProps> = ({
criteriaId: null,
});
const onAddHandler = useCallback(
(val: AddCriteriaScheme) => {
(val: AddCriteriaSchema) => {
if (goalId) {
onAddCriteria({ ...val, goalId });
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/GoalEditForm/GoalEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const GoalEditForm: React.FC<GoalEditFormProps> = ({ goal, onSubmit }) => {
// FIXME: nullable values are conflicting with undefined
return (
<GoalForm
validityScheme={goalUpdateSchema}
validitySchema={goalUpdateSchema}
id={goal.id}
busy={busy}
title={goal.title}
Expand Down
10 changes: 5 additions & 5 deletions src/components/GoalForm/GoalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ interface GoalFormProps {
type: DateType;
};
busy?: boolean;
validityScheme: Schema;
validitySchema: Schema;
id?: string;
tip?: React.ReactNode;

onSumbit: (fields: z.infer<GoalFormProps['validityScheme']>) => void;
onSumbit: (fields: z.infer<GoalFormProps['validitySchema']>) => void;
}

export const GoalForm: React.FC<GoalFormProps> = ({
Expand All @@ -66,7 +66,7 @@ export const GoalForm: React.FC<GoalFormProps> = ({
priority,
estimate,
busy,
validityScheme,
validitySchema,
actionButton,
tip,
onSumbit,
Expand All @@ -80,8 +80,8 @@ export const GoalForm: React.FC<GoalFormProps> = ({
setFocus,
setValue,
formState: { errors, isSubmitted },
} = useForm<z.infer<typeof validityScheme>>({
resolver: zodResolver(validityScheme),
} = useForm<z.infer<typeof validitySchema>>({
resolver: zodResolver(validitySchema),
mode: 'onChange',
reValidateMode: 'onChange',
shouldFocusError: false,
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserSettingsPage/UserSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const StyledLabel = styled.label`
background-color: transparent;
`;

const patchUserSchemeWithAsyncValidate = (validityFn: (val: string) => Promise<boolean>) => {
const patchUserSchemaWithAsyncValidate = (validityFn: (val: string) => Promise<boolean>) => {
return updateUserSchema.merge(
z.object({
nickname: updateUserSchema.shape.nickname.refine(
Expand Down Expand Up @@ -82,7 +82,7 @@ export const UserSettingsPage = ({ user, ssrTime }: ExternalPageProps) => {
);

const generalForm = useForm<UpdateUser>({
resolver: zodResolver(patchUserSchemeWithAsyncValidate(validateNicknameAsync)),
resolver: zodResolver(patchUserSchemaWithAsyncValidate(validateNicknameAsync)),
mode: 'onChange',
reValidateMode: 'onChange',
shouldFocusError: true,
Expand Down
16 changes: 8 additions & 8 deletions src/hooks/useGoalResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { notifyPromise } from '../utils/notifyPromise';
import { GoalCommon, GoalStateChangeSchema, GoalUpdate, ToggleGoalDependency } from '../schema/goal';
import { GoalByIdReturnType } from '../../trpc/inferredTypes';
import {
AddCriteriaScheme,
RemoveCriteriaScheme,
UpdateCriteriaScheme,
UpdateCriteriaStateScheme,
AddCriteriaSchema,
RemoveCriteriaSchema,
UpdateCriteriaSchema,
UpdateCriteriaStateSchema,
} from '../schema/criteria';
import { ModalEvent, dispatchModalEvent } from '../utils/dispatchModal';

Expand Down Expand Up @@ -268,7 +268,7 @@ export const useGoalResource = (fields: GoalFields, config?: InvalidateConfigura
}, [fields.comments, fields.stateId]);

const onGoalCriteriaAdd = useCallback(
async (val: AddCriteriaScheme, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
async (val: AddCriteriaSchema, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
await addGoalCriteria.mutateAsync(val);

invalidate(invalidateKey);
Expand All @@ -277,7 +277,7 @@ export const useGoalResource = (fields: GoalFields, config?: InvalidateConfigura
);

const onGoalCriteriaToggle = useCallback(
async (val: UpdateCriteriaStateScheme, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
async (val: UpdateCriteriaStateSchema, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
await toggleGoalCriteria.mutateAsync(val);

invalidate(invalidateKey);
Expand All @@ -286,7 +286,7 @@ export const useGoalResource = (fields: GoalFields, config?: InvalidateConfigura
);

const onGoalCriteriaUpdate = useCallback(
async (val: UpdateCriteriaScheme, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
async (val: UpdateCriteriaSchema, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
await updateGoalCriteria.mutateAsync(val);

invalidate(invalidateKey);
Expand All @@ -295,7 +295,7 @@ export const useGoalResource = (fields: GoalFields, config?: InvalidateConfigura
);

const onGoalCriteriaRemove = useCallback(
async (val: RemoveCriteriaScheme, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
async (val: RemoveCriteriaSchema, invalidateKey?: RefetchKeys | RefetchKeys[]) => {
await removeGoalCriteria.mutateAsync(val);

invalidate(invalidateKey);
Expand Down
4 changes: 2 additions & 2 deletions src/schema/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export const queryWithFiltersSchema = z.object({

export type QueryWithFilters = z.infer<typeof queryWithFiltersSchema>;

export const suggestionsQueryScheme = z.object({
export const suggestionsQuerySchema = z.object({
limit: z.number().optional(),
input: z.string(),
});

export type SuggestionsQueryScheme = z.infer<typeof suggestionsQueryScheme>;
export type SuggestionsQuerySchema = z.infer<typeof suggestionsQuerySchema>;
10 changes: 5 additions & 5 deletions src/schema/criteria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const convertCriteriaToGoalSchema = z.object({
}),
});

export type AddCriteriaScheme = z.infer<typeof criteriaSchema>;
export type UpdateCriteriaStateScheme = z.infer<typeof updateCriteriaState>;
export type UpdateCriteriaScheme = z.infer<typeof updateCriteriaSchema>;
export type RemoveCriteriaScheme = z.infer<typeof removeCriteria>;
export type ConvertCriteriaToGoalScheme = z.infer<typeof convertCriteriaToGoalSchema>;
export type AddCriteriaSchema = z.infer<typeof criteriaSchema>;
export type UpdateCriteriaStateSchema = z.infer<typeof updateCriteriaState>;
export type UpdateCriteriaSchema = z.infer<typeof updateCriteriaSchema>;
export type RemoveCriteriaSchema = z.infer<typeof removeCriteria>;
export type ConvertCriteriaToGoalSchema = z.infer<typeof convertCriteriaToGoalSchema>;
4 changes: 2 additions & 2 deletions trpc/router/goal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
toggleParticipantsSchema,
batchGoalByProjectIdSchema,
} from '../../src/schema/goal';
import { ToggleSubscriptionSchema, suggestionsQueryScheme, queryWithFiltersSchema } from '../../src/schema/common';
import { ToggleSubscriptionSchema, suggestionsQuerySchema, queryWithFiltersSchema } from '../../src/schema/common';
import { connectionMap } from '../queries/connections';
import {
createGoal,
Expand Down Expand Up @@ -52,7 +52,7 @@ const updateProjectUpdatedAt = async (id?: string | null) => {
};
export const goal = router({
suggestions: protectedProcedure
.input(suggestionsQueryScheme)
.input(suggestionsQuerySchema)
.query(async ({ ctx, input: { input, limit = 5 } }) => {
const { activityId } = ctx.session.user || {};

Expand Down

0 comments on commit 57f83d0

Please sign in to comment.