-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip : zod integration in event comment journey step
- Loading branch information
1 parent
c083dce
commit 6e9fbdd
Showing
11 changed files
with
116 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Utilitaire pour obtenir les types des attributs de T | ||
type TypeDesAttributs<T> = { | ||
[K in keyof T]: T[K]; | ||
}; | ||
|
||
// Fonction pour afficher les types des attributs de T | ||
export function afficherTypesDesAttributs<T extends object>( | ||
body: T, | ||
ctor: new () => T | ||
) { | ||
console.log("AFFICHER TYPES DES ATTRIBUTS"); | ||
|
||
// Instancier un nouvel objet de type T | ||
const bodyTypeTarget = new ctor(); | ||
|
||
// Obtenir les clés de l'objet (y compris les symboles) | ||
const keys = [ | ||
...Object.keys(bodyTypeTarget), | ||
...Object.getOwnPropertySymbols(bodyTypeTarget), | ||
] as (keyof T)[]; | ||
|
||
// Créer un objet pour stocker les types des attributs | ||
const types: Record<string, string> = {}; | ||
|
||
// Parcourir les clés et obtenir les types | ||
keys.forEach((key) => { | ||
const keyAsString = String(key); // Convertir la clé en chaîne de caractères | ||
const valeur = body[key as keyof T]; | ||
types[keyAsString] = typeof valeur; | ||
console.log(`Clé: ${keyAsString}, Type: ${typeof valeur}`); | ||
}); | ||
|
||
// Retourner les types des attributs | ||
return types; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Prisma } from "@prisma/client"; | ||
|
||
export type eventWithUserEvents = Prisma.EventGetPayload<{ | ||
include: { userEvents: true }; | ||
}>; | ||
|
||
export type eventWithoutId = { | ||
authorId: number; | ||
journeyId: number; | ||
title: string; | ||
image: string; | ||
numberPlayerMin: number; | ||
numberPlayerMax: number; | ||
description: string; | ||
startAt: Date; | ||
endAt: Date; | ||
isPrivate?: boolean; | ||
accessCode?: string; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters