mirror of
https://github.com/Floriansylvain/SnippetsManager.git
synced 2026-08-19 11:43:15 +02:00
Fixed catgory post
This commit is contained in:
@@ -2,7 +2,6 @@ import { initServer } from '../app.js'
|
||||
import request from 'supertest'
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import bcrypt from 'bcrypt'
|
||||
import { equals } from '@jest/expect-utils'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
const app = initServer()
|
||||
|
||||
@@ -10,6 +10,7 @@ const categoryData = z.object({
|
||||
name: z.string().max(50)
|
||||
}).required()
|
||||
|
||||
// TODO Mettre le where sur le user id plutot que sur un nom de category
|
||||
const categoryGet: RequestHandler = async (req, res) => {
|
||||
let category: Category | null = null
|
||||
|
||||
@@ -33,7 +34,7 @@ const categoryPost: RequestHandler = async (req, res) => {
|
||||
|
||||
try {
|
||||
const newCategory = categoryData.parse(req.body)
|
||||
prisma.category.create({
|
||||
await prisma.category.create({
|
||||
data: {
|
||||
name: newCategory.name,
|
||||
user_id: userId
|
||||
|
||||
Reference in New Issue
Block a user