Need help for Mapping an object #5574
Unanswered
facenordgraphisme
asked this question in
Requests for comment (RFC)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone, I'm stuck with my project of accomodation booking. My client need to be able to choose a price for each week and for each location. I've done my schemas like this :
Product:
export default {
name: 'product',
type: 'document',
title: 'Location',
fields: [
{
name: 'name',
type: 'string',
title: 'Nom Location'
},
{
name: 'images',
type: 'array',
title: 'Image Location',
of: [{type: 'image'}],
},
{
name: 'description',
type: 'text',
title: 'Description Location',
},
{
name: 'slug',
type: 'slug',
title: 'Slug',
options: {
source: 'name'
}
},
{
name: 'price',
type: 'number',
title: 'A partir de',
},
{
name: 'category',
title: 'Station',
type: 'reference',
to: [
{
type: 'category',
},
],
},
{
name: 'disponibilites',
title: 'Disponibilitées',
type: 'array',
of:[{type: 'disponibilites'}]
},
]
}
disponibilites:
export default {
name: 'disponibilites',
title: 'Disponibilités',
type: 'object',
fields: [
{
name: 'semaine',
title:'Semaine',
type: 'reference',
to:[{type: 'semaine'}]
},
{
name: 'prix',
title:'Prix',
type: 'number'
},
]
}
semaine:
export default {
name: 'semaine',
type: 'document',
title: 'Semaines',
fields: [
{
name: 'nom',
title:'Semaine',
type: 'string'
},
{
name: 'debutSemaine',
title:'Du',
type: 'datetime'
},
{
name: 'finSemaine',
title:'Au',
type: 'datetime'
},
]
}
I can create weeks and add a different prices for each weeks and each logement, there is no problems at this point.
My issue is that I can't find the right way to map all of these weeks with each prices on my next Js app...
I've done this query :
Can I have some help?
Regards
Beta Was this translation helpful? Give feedback.
All reactions