1// Copyright (C) 2019 Storj Labs, Inc. 2// See LICENSE for copying information. 3 4package consoleql 5 6import ( 7 "github.com/graphql-go/graphql" 8) 9 10const ( 11 // RewardType is a graphql type for reward. 12 RewardType = "reward" 13 // FieldAwardCreditInCent is a field name for award credit amount for referrers. 14 FieldAwardCreditInCent = "awardCreditInCent" 15 // FieldInviteeCreditInCents is a field name for credit amount rewarded to invitees. 16 FieldInviteeCreditInCents = "inviteeCreditInCents" 17 // FieldRedeemableCap is a field name for the total redeemable amount of the reward offer. 18 FieldRedeemableCap = "redeemableCap" 19 // FieldAwardCreditDurationDays is a field name for the valid time frame of current award credit. 20 FieldAwardCreditDurationDays = "awardCreditDurationDays" 21 // FieldInviteeCreditDurationDays is a field name for the valid time frame of current invitee credit. 22 FieldInviteeCreditDurationDays = "inviteeCreditDurationDays" 23 // FieldExpiresAt is a field name for the expiration time of a reward offer. 24 FieldExpiresAt = "expiresAt" 25 // FieldType is a field name for the type of reward offers. 26 FieldType = "type" 27 // FieldStatus is a field name for the status of reward offers. 28 FieldStatus = "status" 29) 30 31func graphqlReward() *graphql.Object { 32 return graphql.NewObject(graphql.ObjectConfig{ 33 Name: RewardType, 34 Fields: graphql.Fields{ 35 FieldID: &graphql.Field{ 36 Type: graphql.Int, 37 }, 38 FieldAwardCreditInCent: &graphql.Field{ 39 Type: graphql.Int, 40 }, 41 FieldInviteeCreditInCents: &graphql.Field{ 42 Type: graphql.Int, 43 }, 44 FieldRedeemableCap: &graphql.Field{ 45 Type: graphql.Int, 46 }, 47 FieldAwardCreditDurationDays: &graphql.Field{ 48 Type: graphql.Int, 49 }, 50 FieldInviteeCreditDurationDays: &graphql.Field{ 51 Type: graphql.Int, 52 }, 53 FieldType: &graphql.Field{ 54 Type: graphql.Int, 55 }, 56 FieldStatus: &graphql.Field{ 57 Type: graphql.Int, 58 }, 59 FieldExpiresAt: &graphql.Field{ 60 Type: graphql.String, 61 }, 62 }, 63 }) 64} 65