Skip to content

Instantly share code, notes, and snippets.

@esokullu
Created October 12, 2018 16:15
Show Gist options
  • Save esokullu/09609889c8c1ee66ab83b947eec21b74 to your computer and use it in GitHub Desktop.
Save esokullu/09609889c8c1ee66ab83b947eec21b74 to your computer and use it in GitHub Desktop.
# pho-graphql-v1.1
type Facebook implements GraphNode
@permissions(mod: "0x0f751", mask: "0xfffff") # people outside can't read.
{
id: ID,
founder: User!
type User implements ActorNode
@edges(
in:"User:Follow, StatusUpdate:Mention, Edges:Consume, Edges:Message",
out:"Post, React, Comment, Consume, Message, Create, Follow"
)
@permissions(mod: "0x07554", mask: "0xfffff") # user themselves, can manage, members can subscribe, outsiders can just read.
@properties(editable: false, volatile: false, revisionable: false)
{
id: ID!,
username: String! @unique @constraints(regex: "/^[_[a-z0-9]]{1,18}$/"),
password: String! @md5 @constraints(regex: "/^[a-zA-Z0-9_]{4,12}$/"),
join_time: Date! @now
birthday: Date @default(String: "01/15/1983"),
about: String @constraints(maxLength: 255,) @default(String: ""),
}
type Photo implements ObjectNode
@edges(in:"Edges:Post, Edges:React, Edges:Comment, Edges:Consume")
@permissions(mod: "0x07500", mask: "0xfffff") # owner can write, friends can read and like (subscribe)
@properties(expires: 0, editable: false, volatile: false, revisionable: false)
{
id: ID!,
url: String! @constraints(format: "url"),
create_time: Date! @now
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment