This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { gql} = require('apollo-server-express') | |
const account = gql` | |
type token { | |
token:String, | |
date:String, | |
country:String, | |
city:String, | |
ip:String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// products/[pid].js | |
import React from 'react' | |
const productID = (props) => { | |
return <>Test slug: {props.pid}</> | |
} | |
productID.getInitialProps = ({query}) => { | |
const {pid} =query | |
return {pid} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { products } = require('../../../../mongo/model') //import categories mongo model | |
const show_products = async(_,{offset,limit},ctx) => { | |
console.log('offset'+offset) | |
console.log('limit'+limit) | |
const res = await products.find({"storeuid":ctx.token.storeuid},null,{skip:offset,limit:limit}) | |
console.log(res) //return all object in array | |
return res | |
} | |
module.exports={show_products} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//find property_type in products to delete them. | |
const findallid = await products.findOne({ "storeuid": ctx.token.storeuid}).lean() | |
const MapId = await R.map(findallid.data,i=>{ | |
return i._id | |
}) | |
console.log(MapId) <--- return like [id1,id2...] | |
const remove = await products.findOneAndUpdate( | |
{ "storeuid": ctx.token.storeuid }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mfront", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"dev": "next", | |
"build": "next build", | |
"start": "next start", | |
"test": "echo \"Error: no test specified\" && exit 1" |