如何解决React-Admin在AWS中从'data-generator-retail'转换generateData放大schema.graphql
我正在一个项目中尝试在基于awsmplify的项目中重现react-admin演示https://github.com/marmelab/react-admin/tree/master/examples/demo。
我正在使用此库https://github.com/MrHertal/react-admin-amplify来正确建立连接。
react-admin演示程序结合使用data-generator-retail(https://github.com/marmelab/react-admin/tree/master/examples/data-generator)和“ fakerest”,“ ra-data -fakerest”和“ fetch-mock”来设置演示数据源,并显示该数据结构:
**customers**
id: integer
first_name: string
last_name: string
email: string
address: string
zipcode: string
city: string
avatar: string
birthday: date
first_seen: date
last_seen: date
has_ordered: boolean
latest_purchase
has_newsletter: boolean
groups: array
nb_commands: integer
total_spent: integer
**categories**
id: number
name: string
**products**
id: integer
category_id: integer
reference: string
width: float
height: float
price: float
thumbnail: string
image: string
description: string
stock: integer
**commands**
id: integer
reference: string
date: date
customer_id: integer
basket: [{ product_id: integer,quantity: integer }]
total_ex_taxes: float
delivery_fees: float
tax_rate: float
taxes: float
total: float
status: 'ordered' | 'delivered' | 'canceled'
returned: boolean
**invoices**
id: integer
date: date
command_id: integer
customer_id: integer
total_ex_taxes: float
delivery_fees: float
tax_rate: float
taxes: float
total: float
**reviews**
id: integer
date: date
status: 'pending' | 'accepted' | 'rejected'
command_id: integer
product_id: integer
customer_id: integer
rating: integer
comment: string
有人知道在awsmplify的“ schema.graphql”文件中再现上述模式的最佳方法吗?
我的学徒尝试使我想到了这一点:
type customers
@model
@auth(rules: [
{ allow: groups,groups: ["admin"] }
])
{
id: ID!
first_name: String
last_name: String
email: AWSEmail
address: String
zipcode: String
city: String
avatar: String
birthday: AWSDateTime
first_seen: AWSDateTime
last_seen: AWSDateTime
has_ordered: Boolean
latest_purchase : AWSDateTime
has_newsletter: Boolean
#groups: array #Doubt about which type of data is equivalent
nb_commands: Int
total_spent: Int}
type categories
@model
@auth(rules: [
{ allow: groups,groups: ["admin"] }
])
{
id: ID!
name: String}
type products
@model
@auth(rules: [
{ allow: groups,groups: ["admin"] }
])
{
id: ID!
category_id: Int
reference: String
width: Float
height: Float
price: Float
thumbnail: String
image: String
description: String
stock: Int}
type commands
@model
@auth(rules: [
{ allow: groups,groups: ["admin"] }
])
{
id: ID!
reference: String
AWSDateTime: AWSDateTime
customer_id: Int
#basket: [{ product_id: Int,quantity: Int }] # Doubt about how to represent this field
total_ex_taxes: Float
delivery_fees: Float
tax_rate: Float
taxes: Float
total: Float
status: ["ordered","delivered","canceled"]
returned: Boolean}
type invoices
@model
@auth(rules: [
{ allow: groups,groups: ["admin"] }
])
{
id: ID!
AWSDateTime: AWSDateTime
command_id: Int
customer_id: Int
total_ex_taxes: Float
delivery_fees: Float
tax_rate: Float
taxes: Float
total: Float}
type reviews
@model
@auth(rules: [
{ allow: groups,groups: ["admin"] }
])
{
id: ID!
AWSDateTime: AWSDateTime
status: ["pending","accepted","rejected"]
command_id: Int
product_id: Int
customer_id: Int
rating: Int
comment: String}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。