Added Statuscodes
Status Rückmeldungen den 'returns' hinzugefügt. Schanbro/PsalmTafel#30
This commit is contained in:
1 parent
80d88608bd
commit
a81ea69a8a
2 files changed
+36
-28
No files matched your search
+5
-5
@@ -9,7 +9,7 @@ import { prisma } from "@/lib/db/prisma";
|
||||
*/
|
||||
export async function getSongBooks() {
|
||||
try {
|
||||
const songBooks = await prisma.songBookModel.findMany({ // Name deines Prisma-Modells für Bücher
|
||||
const songBooks = await prisma.songBook.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
@@ -36,7 +36,7 @@ export async function getSongBooks() {
|
||||
*/
|
||||
export async function getSongBookById(id: number) {
|
||||
try {
|
||||
const songBook = await prisma.songBookModel.findUnique({
|
||||
const songBook = await prisma.songBook.findUnique({
|
||||
where: { id },
|
||||
select: {
|
||||
id: true,
|
||||
@@ -85,7 +85,7 @@ export async function searchSongBookByTitle(query: string, limit: number = 20) {
|
||||
return { success: true, songBooks: [] };
|
||||
}
|
||||
|
||||
const songBooks = await prisma.songBookModel.findMany({
|
||||
const songBooks = await prisma.songBook.findMany({
|
||||
where: {
|
||||
title: {
|
||||
contains: cleanQuery,
|
||||
@@ -130,7 +130,7 @@ export async function searchSongBookByTitle(query: string, limit: number = 20) {
|
||||
*/
|
||||
export async function createSongBook(data: { title: string; language: string }) {
|
||||
try {
|
||||
const songBook = await prisma.songBookModel.create({
|
||||
const songBook = await prisma.songBook.create({
|
||||
data: {
|
||||
title: data.title,
|
||||
language: data.language,
|
||||
@@ -214,7 +214,7 @@ export async function updateSongBook(
|
||||
*/
|
||||
export async function deleteSongBook(id: number) {
|
||||
try {
|
||||
const songBook = await prisma.songBookModel.delete({
|
||||
const songBook = await prisma.songBook.delete({
|
||||
where: { id },
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
Reference in new issue
Block a user