small typescript adjustments

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2022-02-05 14:58:20 +01:00
parent dea3aaf477
commit 9534bc270f
3 changed files with 6 additions and 9 deletions

View file

@ -2,15 +2,12 @@ import { prisma } from '../../services'
import { Wishlist, WishlistItem } from '@/types' import { Wishlist, WishlistItem } from '@/types'
export default { export default {
getAll: async (): Promise<any> => { getAll: async (): Promise<Wishlist[]> => {
return await prisma.client.wishlist.findMany({ return (await prisma.client.wishlist.findMany({
include: { items: false }, include: { items: false },
}) })) as Wishlist[]
}, },
getBySlugUrlText: async ( getBySlugUrlText: async (value: string, includeItems = false) => {
value: string,
includeItems = false
): Promise<any> => {
return await prisma.client.wishlist.findUnique({ return await prisma.client.wishlist.findUnique({
where: { where: {
slugUrlText: value, slugUrlText: value,

View file

@ -14,7 +14,7 @@ export interface Wishlist {
description: string description: string
imageSrc: string imageSrc: string
slugUrlText: string slugUrlText: string
items: WishlistItem[] items?: WishlistItem[]
} }
export interface TileProp { export interface TileProp {
title: string title: string

View file

@ -16,7 +16,7 @@ const { list, fetch, updateItem } = useWishlistStore()
await fetch(route.params.slug as string) await fetch(route.params.slug as string)
const notBoughtItems = computed(() => { const notBoughtItems = computed(() => {
return list.value?.items.filter( return list.value?.items?.filter(
(item: WishlistItemType) => item.bought === false (item: WishlistItemType) => item.bought === false
) )
}) })