Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: small fix #286

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions apps/admin/app/ui/dashboard/addresses/AddAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,7 @@ function addAddress({ addresses, setAddresses }: Props): JSX.Element {
</div>
</div>
<div className="flex gap-4 mt-4">
<Button
type="submit"
className="w-full"
disabled={form.formState.isSubmitting || !form.formState.isValid}
>
<Button type="submit" className="w-full" disabled={form.formState.isSubmitting}>
Créer
</Button>
<Button variant="secondary" type="button" onClick={() => setOpen(false)} className="w-full">
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/app/ui/dashboard/addresses/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function EditForm(props: EditFormProps): JSX.Element {
</div>
</div>
<div className="flex gap-4 mt-4">
<Button type="submit" disabled={form.formState.isSubmitting || !form.formState.isValid}>
<Button type="submit" disabled={form.formState.isSubmitting}>
Modifier
</Button>
<Button
Expand Down
18 changes: 7 additions & 11 deletions apps/admin/app/ui/dashboard/tournaments/AddTournaments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function AddTournaments({ tournaments, setTournaments, addresses, sports }: Prop
team_capacity: z.coerce
.number({ message: 'Le champ doit contenir un nombre' })
.min(1, { message: "La capacité de l'équipe ne peut être inférieur à 1" }),
id_address: z.number().min(1).optional(),
id_sport: z.number().min(1).optional(),
id_address: z.coerce.number().optional(),
id_sport: z.coerce.number().optional(),
rules: z.string().optional(),
prize: z.string().optional(),
image: z
Expand All @@ -75,8 +75,8 @@ function AddTournaments({ tournaments, setTournaments, addresses, sports }: Prop
default_match_length: undefined,
max_participants: 1,
team_capacity: 1,
id_address: undefined,
id_sport: undefined,
id_address: -1,
id_sport: -1,
rules: '',
prize: '',
},
Expand All @@ -88,8 +88,8 @@ function AddTournaments({ tournaments, setTournaments, addresses, sports }: Prop
if (values.default_match_length) formData.append('default_match_length', values.default_match_length.toString());
formData.append('max_participants', values.max_participants.toString());
formData.append('team_capacity', values.team_capacity.toString());
if (values.id_address) formData.append('id_address', values.id_address.toString());
if (values.id_sport) formData.append('id_sport', values.id_sport.toString());
if (values.id_address !== -1 && values.id_address) formData.append('id_address', values.id_address.toString());
if (values.id_sport !== -1 && values.id_sport) formData.append('id_sport', values.id_sport.toString());
if (values.rules) formData.append('rules', values.rules);
if (values.prize) formData.append('prize', values.prize);
formData.append('image', values.image[0]);
Expand Down Expand Up @@ -312,11 +312,7 @@ function AddTournaments({ tournaments, setTournaments, addresses, sports }: Prop
</div>
</div>
<div className="flex gap-4 mt-4">
<Button
type="submit"
className="w-full"
disabled={form.formState.isSubmitting || !form.formState.isValid}
>
<Button type="submit" className="w-full" disabled={form.formState.isSubmitting}>
Créer
</Button>
<Button variant="secondary" type="button" onClick={() => setOpen(false)} className="w-full">
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/app/ui/dashboard/tournaments/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function EditForm(props: EditFormProps): JSX.Element {
e.preventDefault();
props.closeDialog();
}}
disabled={form.formState.isSubmitting || !form.formState.isValid}
disabled={form.formState.isSubmitting}
>
Annuler
</Button>
Expand Down
6 changes: 1 addition & 5 deletions apps/admin/app/ui/dashboard/votes/AddPoll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,7 @@ function AddPoll({ polls, setPolls, assemblies }: Props) {
</Button>
</div>
<div className="flex gap-4 mt-4">
<Button
type="submit"
className="w-full"
disabled={form.formState.isSubmitting || !form.formState.isValid}
>
<Button type="submit" className="w-full" disabled={form.formState.isSubmitting}>
Créer
</Button>
<Button variant="secondary" type="button" onClick={() => setOpen(false)} className="w-full">
Expand Down
6 changes: 1 addition & 5 deletions apps/admin/app/ui/dashboard/votes/EditPoll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ function EditPoll({ poll, setter, assemblies }: Props) {
/>
</div>
<div className="flex gap-4 mt-4">
<Button
type="submit"
className="w-full"
disabled={form.formState.isSubmitting || !form.formState.isValid}
>
<Button type="submit" className="w-full" disabled={form.formState.isSubmitting}>
Modifier
</Button>
<Button variant="secondary" type="button" className="w-full">
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"autoprefixer": "^10.4.19",
"postcss": "^8.4.39",
"tailwindcss": "^3.4.6",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
}
}
10 changes: 5 additions & 5 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@repo/types": "workspace:*",
"@supabase/supabase-js": "^2.44.4",
"hono": "^4.5.1",
"resend": "^3.4.0",
"resend": "^3.5.0",
"socket.io": "^4.7.5",
"stripe": "^16.2.0",
"zod": "^3.23.8",
Expand All @@ -34,10 +34,10 @@
"@repo/typescript-config": "workspace:*",
"@types/node": "^20.14.11",
"@types/swagger-ui-dist": "^3.30.5",
"@vitest/coverage-v8": "^2.0.3",
"supabase": "^1.183.5",
"@vitest/coverage-v8": "^2.0.4",
"supabase": "^1.187.3",
"tsx": "^4.16.2",
"typescript": "^5.5.3",
"vitest": "^2.0.3"
"typescript": "^5.5.4",
"vitest": "^2.0.4"
}
}
5 changes: 3 additions & 2 deletions apps/api/src/handlers/tournaments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ tournaments.openapi(getTournamentById, async (c) => {
});

tournaments.openapi(createTournament, async (c) => {
const { name, default_match_length, max_participants, team_capacity, rules, prize, id_address, image } =
const { name, default_match_length, max_participants, team_capacity, rules, prize, id_address, id_sport, image } =
c.req.valid('form');

if (image === null) {
return c.json({ error: 'You must provide an image' }, 400);
}
Expand All @@ -99,7 +100,7 @@ tournaments.openapi(createTournament, async (c) => {

const { data, error } = await supabase
.from('TOURNAMENTS')
.insert({ name, default_match_length, max_participants, team_capacity, rules, prize, id_address })
.insert({ name, default_match_length, max_participants, team_capacity, rules, prize, id_address, id_sport })
.select()
.single();

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/validators/tournaments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const createTournamentSchema = z.object({
rules: z.string().optional(),
prize: z.string().optional(),
id_address: z.coerce.number().min(1).optional(),
description: z.string().optional(),
id_sport: z.coerce.number().min(1).optional(),
description: z.string().optional(),
image: z.instanceof(File),
});

Expand Down
1 change: 0 additions & 1 deletion apps/client/app/(withNavbar)/blog/myposts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function Page(): JSX.Element {
}, [router]);

function fetchPosts(user: User | null) {
console.log('user : ', user);
fetch(`${process.env.NEXT_PUBLIC_API_URL}/blog/posts?skip=0&take=20&userId=${user?.id}`)
.then((r) => {
return r.json();
Expand Down
4 changes: 2 additions & 2 deletions apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"types:check": "tsc --noEmit"
},
"dependencies": {
"date-fns": "^3.6.0",
"@hookform/resolvers": "^3.9.0",
"@repo/types": "workspace:*",
"@repo/ui": "workspace:*",
"date-fns": "^3.6.0",
"lucide-react": "^0.412.0",
"next": "^14.2.5",
"next-themes": "^0.3.0",
Expand All @@ -36,6 +36,6 @@
"autoprefixer": "^10.4.19",
"postcss": "^8.4.39",
"tailwindcss": "^3.4.6",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
}
}
12 changes: 4 additions & 8 deletions packages/types/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export type Database = {
};
Relationships: [
{
foreignKeyName: 'public_ADDRESS_id_lease_fkey';
foreignKeyName: 'ADDRESSES_id_lease_fkey';
columns: ['id_lease'];
isOneToOne: false;
referencedRelation: 'LEASE';
Expand Down Expand Up @@ -1589,7 +1589,7 @@ export type Database = {
foreignKeyName: 'TOURNAMENTS_id_address_fkey';
columns: ['id_address'];
isOneToOne: false;
referencedRelation: 'TOURNAMENTS';
referencedRelation: 'ADDRESSES';
referencedColumns: ['id'];
},
{
Expand Down Expand Up @@ -1718,14 +1718,14 @@ export type Database = {
};
Relationships: [
{
foreignKeyName: 'public_USERS_TEAMS_id_team_fkey';
foreignKeyName: 'USERS_TEAMS_id_team_fkey';
columns: ['id_team'];
isOneToOne: false;
referencedRelation: 'TEAMS';
referencedColumns: ['id'];
},
{
foreignKeyName: 'public_USERS_TEAMS_id_user_fkey';
foreignKeyName: 'USERS_TEAMS_id_user_fkey';
columns: ['id_user'];
isOneToOne: false;
referencedRelation: 'USERS';
Expand Down Expand Up @@ -2056,10 +2056,6 @@ export type Database = {
updated_at: string;
}[];
};
operation: {
Args: Record<PropertyKey, never>;
Returns: string;
};
search: {
Args: {
prefix: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"postcss": "^8.4.39",
"react": "^18.3.1",
"tailwindcss": "^3.4.6",
"typescript": "^5.5.3"
"typescript": "^5.5.4"
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
Expand All @@ -52,7 +52,7 @@
"cmdk": "^1.0.0",
"lucide-react": "^0.412.0",
"next-themes": "^0.3.0",
"react-aria": "^3.33.1",
"react-aria": "^3.34.0",
"react-day-picker": "^8.10.1",
"react-hook-form": "^7.52.1",
"recharts": "^2.12.7",
Expand Down
Loading
Loading