Z
Zod3mo ago
adxvcasas

adxvcasas - Hello, so right now I have checkbox...

Hello, so right now I have checkbox wherein I can store multiple strings inside an array, but the problem i'm encountering right now is when I'm storing it to my database mysql using prisma orm , I get a warning of Field "doesHaveTCETAssitance" in model "AppoinmentSchedule" can't be a list. The current connector does not support lists of primitive types.Prisma, because I set doesHaveTCETAssitance to doesHaveTCETAssitance String[] which is not supported by prisma mysql.
doesHaveTCETAssitance: z.array(z.string()).refine((value) => value.some((item) => item), {
message: 'Please select at lease on the option'
}),
doesHaveTCETAssitance: z.array(z.string()).refine((value) => value.some((item) => item), {
message: 'Please select at lease on the option'
}),
Now the question is, is there any possible way to store multiple strings without storing it into array?
1 Reply
Scott Trinh
Scott Trinh3mo ago
This isn't really a zod question, but you can use a CSV-like format (basically doesHaveTCETAssitance.join(",")) or come up with a more robust separator like "%%%%%" or the unicode "unit separator" control character (see https://www.lammertbies.nl/comm/info/ascii-characters).
Lammert Bies
Lammert Bies
ASCII character set - Lammert Bies
The ASCII character set with detailed description of the functionality of the control codes.