问题描述
我正在一个项目中尝试在基于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 (将#修改为@)