Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议的schema #1

Open
myWsq opened this issue Jul 19, 2018 · 0 comments
Open

建议的schema #1

myWsq opened this issue Jul 19, 2018 · 0 comments

Comments

@myWsq
Copy link
Member

myWsq commented Jul 19, 2018

enum Role {
	ADMIN
	CUSTOMER
}

type User {
	_id: String!
	idCard: String!
	phone: String!
	name: String!
	address: String!
	role: [Role!]!
	createdAt: Int! #timestamp
	updateAt: Int!
}

enum OrderCategory {
	CUSTOMER
	SELLER
}

type Order {
	_id: String!
	price: Float!
	amount: Int!
	type: String!
	category: OrderCategory!
	matches(limit: Int): [Match!]! # 默认以score降序排序
	user: User!
	deadline: Int
	createdAt: Int!
	updateAt: Int!
}

type Match {
	_id: String!
	sellerOrder: Order!
	customerOrder: Order!
	signed: Boolean!
	matchScore: Int! #0-100
	createdAt: Int!
	updateAt: Int!
}

type Query {
	customerOrders: [Order!]!
	sellerOrders: [Order!]!
	matches: [Match!]!
	me: User!
}

input createOrderInput {
	price: Float!
	amount: Int!
	type: String!
	category: OrderCategory!
	user: User!
	deadline: Int
}

type Mutation {
	createOrder(data: createOrderInput): Order!
	finishMatch(_id: String!): Match!
	login(username: String!, password: String!): User!
	logout: User!
}

enum OP {
	CREATE
	UPDATE
	DELETE
}

type MatchSubcriptionPayLoad {
	op: OP!
	data: Match!
}

type Subscription {
	matchState: Boolean! # 后台是否在进行匹配
	match: MatchSubcriptionPayLoad! # 匹配列表变化情况
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant