import { GQLProduct } from './../schemas.d' ; const PRODUCTS = [ ] ; export async function getProduct ( id ) { return PRODUCTS . find ( p => p . id === id ) ; } export async function getAllProducts ( ) { return PRODUCTS ; } export async function addProduct ( name , text ? ) { const newProduct = { id : PRODUCTS . length . toString ( ) , name , text , createdAt : new Date ( ) } ; PRODUCTS . push ( newProduct ) ; return newProduct ; }