Skip to content

Instantly share code, notes, and snippets.

@savioserra
Last active May 8, 2019 16:56
Show Gist options
  • Save savioserra/611cf022b33fe735a337dab3059e2337 to your computer and use it in GitHub Desktop.
Save savioserra/611cf022b33fe735a337dab3059e2337 to your computer and use it in GitHub Desktop.
Ligapay Schema
type User {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "users_id_seq", initialValue: 1, allocationSize: 1)
email: String! @unique
globoToken: String
password: String!
team: Team!
wallet: Wallet! @db(name: "wallet_id") @unique @relation(link: INLINE)
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
deleted: Boolean! @default(value: false)
}
type League {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "leagues_id_seq", initialValue: 1, allocationSize: 1)
name: String! @unique
adminTax: Int! @default(value: 0)
avatar: String
description: String
fee: Int! @default(value: 0)
limit: Int! @default(value: 20)
wallet: Wallet! @db(name: "wallet_id") @unique @relation(link: INLINE)
leagueType: LeagueType! @db(name: "league_type_id")
subscriptions: [LeagueSubscription]
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
deleted: Boolean! @default(value: false)
}
type LeagueType {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "league_types_id_seq", initialValue: 1, allocationSize: 1)
name: String! @unique
description: String
leagues: [League]
createdAt: DateTime @createdAt
updatedAt: DateTime! @updatedAt
deleted: Boolean! @default(value: false)
}
type Score {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "scores_id_seq", initialValue: 1, allocationSize: 1)
score: Int!
season: Season! @db(name: "season_id")
team: Team! @db(name: "team_id")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Season {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "seasons_id_seq", initialValue: 1, allocationSize: 1)
name: String! @unique
description: String
scores: [Score]
subscriptions: [LeagueSubscription]
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type LeagueSubscription @db(name: "subscriptions") {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "subscriptions_id_seq", initialValue: 1, allocationSize: 1)
fee: Int! @default(value: 0)
league: League! @db(name: "league_id")
season: Season! @db(name: "season_id")
team: Team! @db(name: "team_id")
updatedAt: DateTime @updatedAt
createdAt: DateTime @createdAt
}
type Team {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "teams_id_seq", initialValue: 1, allocationSize: 1)
name: String! @unique
avatar: String
scores: [Score]
owner: User! @db(name: "user_id") @unique @relation(link: INLINE)
subscriptions: [LeagueSubscription]
createdAt: DateTime @createdAt
updatedAt: DateTime @updatedAt
deleted: Boolean! @default(value: false)
}
type Transaction {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "transactions_id_seq", initialValue: 1, allocationSize: 1)
amount: Int!
destination: Wallet! @db(name: "wallet_destination_id") @relation(link: INLINE, name: "TransactionWalletDestinyToWalletTransactions")
origin: Wallet! @db(name: "wallet_origin_id") @relation(link: INLINE, name: "TransactionWalletOriginToWalletTransactions")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Wallet {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "wallets_id_seq", initialValue: 1, allocationSize: 1)
amount: Int! @default(value: 0)
user: User
league: League
incomingTransactions: [Transaction] @relation(name: "TransactionWalletDestinyToWalletTransactions")
outgoingTransactions: [Transaction] @relation(name: "TransactionWalletOriginToWalletTransactions")
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment