WIP: Add challenges feature schema and operations
- Add Challenge, ChallengeEntry, ChallengeInvitation, RuleSet types - Add queries: challenges, challenge, challengeLeaderboard, myChallengeInvitations, myChallengeEntries, ruleSets - Add mutations: createChallenge, createRuleSet, inviteUsersToChallenge, respondToChallengeInvitation, startChallenge, submitChallengeEntry, recalculateChallengeEntry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
207
src/operations/challenges.gql
Normal file
207
src/operations/challenges.gql
Normal file
@@ -0,0 +1,207 @@
|
||||
query GetChallenges {
|
||||
challenges {
|
||||
id
|
||||
name
|
||||
description
|
||||
minimumShots
|
||||
startDate
|
||||
endDate
|
||||
createdAt
|
||||
updatedAt
|
||||
requiredTableSize
|
||||
requiredPocketSize
|
||||
isPublic
|
||||
maxAttempts
|
||||
ruleSet {
|
||||
id
|
||||
name
|
||||
description
|
||||
}
|
||||
createdBy {
|
||||
id
|
||||
username
|
||||
profileImageUri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query GetChallenge($id: ID!) {
|
||||
challenge(id: $id) {
|
||||
id
|
||||
name
|
||||
description
|
||||
minimumShots
|
||||
startDate
|
||||
endDate
|
||||
createdAt
|
||||
updatedAt
|
||||
requiredTableSize
|
||||
requiredPocketSize
|
||||
isPublic
|
||||
maxAttempts
|
||||
ruleSet {
|
||||
id
|
||||
name
|
||||
description
|
||||
}
|
||||
createdBy {
|
||||
id
|
||||
username
|
||||
profileImageUri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query GetRuleSets {
|
||||
ruleSets {
|
||||
id
|
||||
name
|
||||
description
|
||||
}
|
||||
}
|
||||
|
||||
query GetChallengeLeaderboard($challengeId: ID!, $limit: Int) {
|
||||
challengeLeaderboard(challengeId: $challengeId, limit: $limit) {
|
||||
id
|
||||
status
|
||||
shotsCount
|
||||
makesCount
|
||||
makeRate
|
||||
qualified
|
||||
createdAt
|
||||
user {
|
||||
id
|
||||
username
|
||||
profileImageUri
|
||||
}
|
||||
video {
|
||||
id
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query GetMyChallengeInvitations {
|
||||
myChallengeInvitations {
|
||||
id
|
||||
status
|
||||
createdAt
|
||||
challenge {
|
||||
id
|
||||
name
|
||||
description
|
||||
startDate
|
||||
endDate
|
||||
createdBy {
|
||||
id
|
||||
username
|
||||
profileImageUri
|
||||
}
|
||||
}
|
||||
inviter {
|
||||
id
|
||||
username
|
||||
profileImageUri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation CreateRuleSet($name: String!, $description: String) {
|
||||
createRuleSet(name: $name, description: $description) {
|
||||
id
|
||||
name
|
||||
description
|
||||
}
|
||||
}
|
||||
|
||||
mutation CreateChallenge(
|
||||
$name: String!
|
||||
$ruleSetId: ID!
|
||||
$minimumShots: Int!
|
||||
$startDate: DateTime!
|
||||
$endDate: DateTime!
|
||||
$description: String
|
||||
$requiredTableSize: Float
|
||||
$requiredPocketSize: Float
|
||||
$isPublic: Boolean! = false
|
||||
$maxAttempts: Int
|
||||
) {
|
||||
createChallenge(
|
||||
name: $name
|
||||
ruleSetId: $ruleSetId
|
||||
minimumShots: $minimumShots
|
||||
startDate: $startDate
|
||||
endDate: $endDate
|
||||
description: $description
|
||||
requiredTableSize: $requiredTableSize
|
||||
requiredPocketSize: $requiredPocketSize
|
||||
isPublic: $isPublic
|
||||
maxAttempts: $maxAttempts
|
||||
) {
|
||||
id
|
||||
name
|
||||
description
|
||||
requiredTableSize
|
||||
requiredPocketSize
|
||||
isPublic
|
||||
maxAttempts
|
||||
}
|
||||
}
|
||||
|
||||
mutation InviteUsersToChallenge($challengeId: ID!, $userIds: [ID!]!) {
|
||||
inviteUsersToChallenge(challengeId: $challengeId, userIds: $userIds) {
|
||||
id
|
||||
status
|
||||
inviter {
|
||||
id
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation RespondToChallengeInvitation($invitationId: ID!, $accept: Boolean!) {
|
||||
respondToChallengeInvitation(invitationId: $invitationId, accept: $accept) {
|
||||
id
|
||||
status
|
||||
challenge {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation StartChallenge($challengeId: ID!) {
|
||||
startChallenge(challengeId: $challengeId) {
|
||||
id
|
||||
status
|
||||
createdAt
|
||||
challenge {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation SubmitChallengeEntry($entryId: ID!, $videoId: ID!) {
|
||||
submitChallengeEntry(entryId: $entryId, videoId: $videoId) {
|
||||
id
|
||||
status
|
||||
qualified
|
||||
makeRate
|
||||
shotsCount
|
||||
makesCount
|
||||
video {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mutation RecalculateChallengeEntry($entryId: ID!) {
|
||||
recalculateChallengeEntry(entryId: $entryId) {
|
||||
id
|
||||
status
|
||||
qualified
|
||||
makeRate
|
||||
shotsCount
|
||||
makesCount
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user