From 787a229ddf1f997dae265133332365f1f87b7064 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Sat, 19 Oct 2019 18:18:39 +0200 Subject: [PATCH] chore: switch to int64 ids (snowflake) --- AUTHORS | 1 + api/pwdb.proto | 94 +- api/pwengine.proto | 4 +- docs/gen.sum | 4 +- go/cmd/pathwar/main.go | 63 +- go/gen.sum | 4 +- go/go.mod | 3 +- go/go.sum | 4 +- go/internal/testutil/doc.go | 1 + go/internal/testutil/logging.go | 29 + go/pkg/pwdb/db.go | 30 +- go/pkg/pwdb/errors.go | 11 + go/pkg/pwdb/helpers.go | 41 +- go/pkg/pwdb/migrations.go | 11 +- go/pkg/pwdb/pwdb.pb.go | 2248 ++++++----------- go/pkg/pwdb/testing.go | 13 +- go/pkg/pwengine/api_dev_generatefakedata.go | 2 +- go/pkg/pwengine/api_pub_getstatus_test.go | 4 +- go/pkg/pwengine/api_pub_getusersession.go | 66 +- .../pwengine/api_pub_getusersession_test.go | 5 +- .../pwengine/api_pub_listtournamentteams.go | 8 +- .../api_pub_listtournamentteams_test.go | 10 +- go/pkg/pwengine/api_pub_ping_test.go | 4 +- go/pkg/pwengine/api_pub_setpreferences.go | 16 +- .../pwengine/api_pub_setpreferences_test.go | 48 +- go/pkg/pwengine/auth.go | 29 +- go/pkg/pwengine/auth_test.go | 14 - go/pkg/pwengine/engine.go | 25 +- go/pkg/pwengine/pwengine.pb.go | 218 +- go/pkg/pwengine/testing.go | 2 +- go/pkg/pwengine/testing_test.go | 10 +- go/pkg/pwserver/server.go | 8 +- go/pkg/pwserver/testing.go | 2 +- go/pkg/pwsso/client.go | 2 +- go/pkg/pwsso/keycloak.go | 14 +- go/pkg/pwsso/testing.go | 4 +- swagger.yaml | 53 +- 37 files changed, 1275 insertions(+), 1830 deletions(-) create mode 100644 go/internal/testutil/doc.go create mode 100644 go/internal/testutil/logging.go create mode 100644 go/pkg/pwdb/errors.go delete mode 100644 go/pkg/pwengine/auth_test.go diff --git a/AUTHORS b/AUTHORS index 9cbe4bd0c..ee4bc0101 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ Cassius de Leeuwe Corentin Kerisit dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Emi_Janina Janina Lucas Germano Manfred Touron diff --git a/api/pwdb.proto b/api/pwdb.proto index b6a056aa9..f725422be 100644 --- a/api/pwdb.proto +++ b/api/pwdb.proto @@ -13,7 +13,7 @@ option (gogoproto.marshaler_all) = true; option (gogoproto.unmarshaler_all) = true; message Challenge { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -42,7 +42,7 @@ message Challenge { message ChallengeList { repeated Challenge items = 1; } message ChallengeVersion { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -70,13 +70,13 @@ message ChallengeVersion { // Challenge challenge = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeID\""]; - string challenge_id = 201 [(gogoproto.customname) = "ChallengeID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 challenge_id = 201 [(gogoproto.customname) = "ChallengeID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; repeated ChallengeFlavor flavors = 202 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; } message ChallengeFlavor { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -89,15 +89,15 @@ message ChallengeFlavor { // associations // - Challenge challenge_version = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeVersionID\""]; - string challenge_version_id = 201 [(gogoproto.customname) = "ChallengeVersionID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + ChallengeVersion challenge_version = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeVersionID\""]; + int64 challenge_version_id = 201 [(gogoproto.customname) = "ChallengeVersionID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; repeated ChallengeInstance instances = 202 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; //repeated ChallengeSubscription subscriptions = 203 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; } message ChallengeInstance { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -119,14 +119,14 @@ message ChallengeInstance { // Hypervisor hypervisor = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:HypervisorID\""]; - string hypervisor_id = 201 [(gogoproto.customname) = "HypervisorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 hypervisor_id = 201 [(gogoproto.customname) = "HypervisorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; ChallengeFlavor flavor = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:FlavorID\""]; - string flavor_id = 203 [(gogoproto.customname) = "FlavorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 flavor_id = 203 [(gogoproto.customname) = "FlavorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message Hypervisor { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -153,7 +153,7 @@ message Hypervisor { } message TeamMember { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -175,14 +175,14 @@ message TeamMember { // User user = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:UserID\""]; - string user_id = 201 [(gogoproto.customname) = "UserID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 user_id = 201 [(gogoproto.customname) = "UserID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; Team team = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:TeamID\""]; - string team_id = 203 [(gogoproto.customname) = "TeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 team_id = 203 [(gogoproto.customname) = "TeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message TournamentMember { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -203,10 +203,10 @@ message TournamentMember { // User user = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:UserID\""]; - string user_id = 201 [(gogoproto.customname) = "UserID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 user_id = 201 [(gogoproto.customname) = "UserID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; TournamentTeam tournament_team = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:TournamentTeamID\""]; - string tournament_team_id = 203 [(gogoproto.customname) = "TournamentTeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 tournament_team_id = 203 [(gogoproto.customname) = "TournamentTeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; repeated Coupon coupons = 204 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; repeated Achievement achievements = 205 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; @@ -219,7 +219,7 @@ message TournamentMember { // User defines a User Account / Profile message User { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -233,7 +233,7 @@ message User { string gravatar_url = 102 [(gogoproto.customname) = "GravatarURL"]; string website_url = 103 [(gogoproto.customname) = "WebsiteURL"]; string locale = 104; - //string oauth_subject = 105 [(gogoproto.moretags) = "gorm:\"unique_index\""]; + string oauth_subject = 105 [(gogoproto.customname) = "OAuthSubject", (gogoproto.moretags) = "gorm:\"unique_index\""]; // // associations @@ -243,15 +243,15 @@ message User { repeated Notification notifications = 201 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; repeated TeamMember memberships = 202 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; TournamentMember active_tournament_member = 203 [(gogoproto.moretags) = "gorm:\"foreignkey:ActiveTournamentMemberID;PRELOAD:false\""]; - string active_tournament_member_id = 204 [(gogoproto.customname) = "ActiveTournamentMemberID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 active_tournament_member_id = 204 [(gogoproto.customname) = "ActiveTournamentMemberID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; TournamentMember active_tournament = 205 [(gogoproto.moretags) = "gorm:\"foreignkey:ActiveTournamentID;PRELOAD:false\""]; - string active_tournament_id = 206 [(gogoproto.customname) = "ActiveTournamentID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 active_tournament_id = 206 [(gogoproto.customname) = "ActiveTournamentID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message UserList { repeated User items = 1; } message Team { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -276,7 +276,7 @@ message Team { message TeamList { repeated Team items = 1; } message Tournament { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -314,7 +314,7 @@ message Tournament { message TournamentList { repeated Tournament items = 1; } message TournamentTeam { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -335,10 +335,10 @@ message TournamentTeam { // Tournament tournament = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:TournamentID\""]; - string tournament_id = 201 [(gogoproto.customname) = "TournamentID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 tournament_id = 201 [(gogoproto.customname) = "TournamentID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; Team team = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:TeamID\""]; - string team_id = 203 [(gogoproto.customname) = "TeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 team_id = 203 [(gogoproto.customname) = "TeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; repeated ChallengeSubscription challenge_subscriptions = 205 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; repeated TournamentMember members = 206 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; @@ -347,7 +347,7 @@ message TournamentTeam { message TournamentTeamList { repeated TournamentTeam items = 1; } message WhoswhoAttempt { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -361,17 +361,17 @@ message WhoswhoAttempt { // associations // TournamentMember author = 200 [(gogoproto.moretags) = "sql:\"not null\" gorm:\"foreignkey:AuthorID\""]; - string author_id = 201 [(gogoproto.customname) = "AuthorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 author_id = 201 [(gogoproto.customname) = "AuthorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; TournamentMember target_member = 202 [(gogoproto.moretags) = "sql:\"not null\" gorm:\"foreignkey:TargetMemberID\""]; - string target_member_id = 203 [(gogoproto.customname) = "TargetMemberID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 target_member_id = 203 [(gogoproto.customname) = "TargetMemberID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; TournamentTeam target_team = 204 [(gogoproto.moretags) = "sql:\"not null\" gorm:\"foreignkey:TargetTeamID\""]; - string target_team_id = 205 [(gogoproto.customname) = "TargetTeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 target_team_id = 205 [(gogoproto.customname) = "TargetTeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message ChallengeValidation { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -398,13 +398,13 @@ message ChallengeValidation { // ChallengeSubscription challenge_subscription = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeSubscriptionID\""]; - string challenge_subscription_id = 201 [(gogoproto.customname) = "ChallengeSubscriptionID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 challenge_subscription_id = 201 [(gogoproto.customname) = "ChallengeSubscriptionID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; TournamentMember tournament_member = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:TournamentMemberID\""]; - string tournament_member_id = 203 [(gogoproto.customname) = "TournamentMemberID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 tournament_member_id = 203 [(gogoproto.customname) = "TournamentMemberID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message ChallengeSubscription { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -418,16 +418,16 @@ message ChallengeSubscription { // TournamentTeam tournament_team = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:TournamentTeamID\""]; - string tournament_team_id = 201 [(gogoproto.customname) = "TournamentTeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 tournament_team_id = 201 [(gogoproto.customname) = "TournamentTeamID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; ChallengeFlavor challenge_flavor = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeFlavorID\""]; - string challenge_flavor_id = 203 [(gogoproto.customname) = "ChallengeFlavorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 challenge_flavor_id = 203 [(gogoproto.customname) = "ChallengeFlavorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; repeated ChallengeValidation validations = 204 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; } message InventoryItem { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -447,12 +447,12 @@ message InventoryItem { // TournamentMember owner = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:OwnerID\""]; - string owner_id = 201 [(gogoproto.customname) = "OwnerID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 owner_id = 201 [(gogoproto.customname) = "OwnerID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message Notification { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -473,11 +473,11 @@ message Notification { // User user = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:UserID\""]; - string user_id = 201 [(gogoproto.customname) = "UserID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 user_id = 201 [(gogoproto.customname) = "UserID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message Coupon { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -493,13 +493,13 @@ message Coupon { // associations // Tournament tournament = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:TournamentID\""]; - string tournament_id = 201 [(gogoproto.customname) = "TournamentID", (gogoproto.moretags) = "gorm:\"index\""]; + int64 tournament_id = 201 [(gogoproto.customname) = "TournamentID", (gogoproto.moretags) = "gorm:\"index\""]; repeated CouponValidation validations = 202 [(gogoproto.moretags) = "gorm:\"PRELOAD:false\""]; } message CouponValidation { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -513,15 +513,15 @@ message CouponValidation { // associations // TournamentMember author = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:AuthorID\""]; - string author_id = 201 [(gogoproto.customname) = "AuthorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 author_id = 201 [(gogoproto.customname) = "AuthorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; Coupon coupon = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:CouponID\""]; - string coupon_id = 203 [(gogoproto.customname) = "CouponID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 coupon_id = 203 [(gogoproto.customname) = "CouponID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message Achievement { - string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; + int64 id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"]; google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; google.protobuf.Timestamp updated_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; //google.protobuf.Timestamp deleted_at = 4 [(gogoproto.stdtime) = true]; @@ -585,10 +585,10 @@ message Achievement { // TournamentMember author = 200 [(gogoproto.moretags) = "gorm:\"foreignkey:AuthorID\""]; - string author_id = 201 [(gogoproto.customname) = "AuthorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 author_id = 201 [(gogoproto.customname) = "AuthorID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; ChallengeValidation challenge_validation = 202 [(gogoproto.moretags) = "gorm:\"foreignkey:ChallengeValidationID\""]; - string challenge_validation_id = 203 [(gogoproto.customname) = "ChallengeValidationID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; + int64 challenge_validation_id = 203 [(gogoproto.customname) = "ChallengeValidationID", (gogoproto.moretags) = "sql:\"not null\" gorm:\"index\""]; } message Dump { diff --git a/api/pwengine.proto b/api/pwengine.proto index a69816f87..38ff0c1ca 100644 --- a/api/pwengine.proto +++ b/api/pwengine.proto @@ -113,11 +113,11 @@ message Void { } message ListTournamentTeamsInput { - string tournament_id = 1 [(gogoproto.customname) = "TournamentID"]; + int64 tournament_id = 1 [(gogoproto.customname) = "TournamentID"]; } message SetPreferencesInput { - string active_tournament_id = 1 [(gogoproto.customname) = "ActiveTournamentID"]; + int64 active_tournament_id = 1 [(gogoproto.customname) = "ActiveTournamentID"]; // bool dark_mode } diff --git a/docs/gen.sum b/docs/gen.sum index 3e15ace38..514a074a4 100644 --- a/docs/gen.sum +++ b/docs/gen.sum @@ -1,7 +1,7 @@ -09f59024ff101848f270b514de148cc2695ef37d ../api/pwengine.proto 30302d31bca0924719daf9e95a0ea15dfbcfb131 ../api/pwhypervisor.proto +4fff3f10be21a6f7e22254700d86c149e6a06bbb ../api/pwengine.proto 58eb4b1d9b5be40a69ffdab1a13b9fb90b669839 ../api/pwsso.proto +5b457e13e87038fcd3124378fdcef56a458b889b ../api/pwdb.proto 5d333f98cfbafd36ddc97b3c7c364bf94b898384 ../api/pwcompose.proto 71351a6ac01962fbeaeeeafd431d481e6c1f288b Makefile -7d781f192af7de0062a3d3ef88fbdffa74409813 ../api/pwdb.proto fb5070d4099e2c7384c026e38f49d73396bcb489 ../api/pwchallenge.proto diff --git a/go/cmd/pathwar/main.go b/go/cmd/pathwar/main.go index 79e4efb7a..e08c92571 100644 --- a/go/cmd/pathwar/main.go +++ b/go/cmd/pathwar/main.go @@ -12,6 +12,7 @@ import ( "os/signal" "time" + "github.com/bwmarrin/snowflake" _ "github.com/go-sql-driver/mysql" // required by gorm "github.com/jinzhu/gorm" "github.com/oklog/run" @@ -93,7 +94,7 @@ func main() { var err error logger, err = config.Build() if err != nil { - return fmt.Errorf("failed to initialize logger: %w", err) + return fmt.Errorf("init logger: %w", err) } } else { config := zap.NewDevelopmentConfig() @@ -103,7 +104,7 @@ func main() { var err error logger, err = config.Build() if err != nil { - return fmt.Errorf("failed to initialize logger: %w", err) + return fmt.Errorf("init logger: %w", err) } } return nil @@ -132,10 +133,10 @@ func main() { return err } - // initialize engine + // init engine engine, _, _, closer, err := engineFromFlags() if err != nil { - return fmt.Errorf("failed to start engine: %w", err) + return fmt.Errorf("start engine: %w", err) } defer closer() @@ -155,7 +156,7 @@ func main() { } start, cleanup, err := pwserver.Start(ctx, engine, opts) if err != nil { - return fmt.Errorf("failed to initialize server: %w", err) + return fmt.Errorf("init server: %w", err) } g.Add( start, @@ -197,16 +198,16 @@ func main() { return err } - // initialize engine + // init engine _, db, _, closer, err := engineFromFlags() if err != nil { - return fmt.Errorf("failed to start engine: %w", err) + return fmt.Errorf("start engine: %w", err) } defer closer() dump, err := pwdb.GetDump(db) if err != nil { - return fmt.Errorf("failed to dump database: %w", err) + return fmt.Errorf("dump database: %w", err) } out, _ := json.MarshalIndent(dump, "", " ") @@ -223,16 +224,16 @@ func main() { return err } - // initialize engine + // init engine _, db, _, closer, err := engineFromFlags() if err != nil { - return fmt.Errorf("failed to start engine: %w", err) + return fmt.Errorf("start engine: %w", err) } defer closer() info, err := pwdb.GetInfo(db, logger) if err != nil { - return fmt.Errorf("failed to get database info: %w", err) + return fmt.Errorf("get database info: %w", err) } out, _ := json.MarshalIndent(info, "", " ") @@ -284,13 +285,13 @@ func main() { } sso, err := ssoFromFlags() if err != nil { - return fmt.Errorf("failed to get sso client from flags: %w", err) + return fmt.Errorf("get sso client from flags: %w", err) } // whoami info, err := sso.Whoami(args[0]) if err != nil { - return fmt.Errorf("failed to get 'whoami' from SSO: %w", err) + return fmt.Errorf("get 'whoami' from SSO: %w", err) } for k, v := range info { fmt.Printf("- %s: %v\n", k, v) @@ -311,12 +312,12 @@ func main() { } sso, err := ssoFromFlags() if err != nil { - return fmt.Errorf("failed to get sso client from flags: %w", err) + return fmt.Errorf("get sso client from flags: %w", err) } // logout if err := sso.Logout(args[0]); err != nil { - return fmt.Errorf("failed to logout from SSO: %w", err) + return fmt.Errorf("logout from SSO: %w", err) } return nil }, @@ -334,13 +335,13 @@ func main() { } sso, err := ssoFromFlags() if err != nil { - return fmt.Errorf("failed to get sso client from flags: %w", err) + return fmt.Errorf("get sso client from flags: %w", err) } // token token, _, err := sso.TokenWithClaims(args[0]) if err != nil { - return fmt.Errorf("failed to get claims: %w", err) + return fmt.Errorf("get claims: %w", err) } out, _ := json.MarshalIndent(token, "", " ") fmt.Println(string(out)) @@ -394,20 +395,24 @@ func main() { } func engineFromFlags() (pwengine.Engine, *gorm.DB, pwsso.Client, func(), error) { - // initialize database + // init database db, err := gorm.Open("mysql", *engineDBURN) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("failed to initialize database: %w", err) + return nil, nil, nil, nil, fmt.Errorf("init database: %w", err) + } + sfn, err := snowflake.NewNode(1) + if err != nil { + return nil, nil, nil, nil, fmt.Errorf("init snowflake: %w", err) } dbOpts := pwdb.Opts{ Logger: logger.Named("gorm"), } - db, err = pwdb.Configure(db, dbOpts) + db, err = pwdb.Configure(db, sfn, dbOpts) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("failed to configure database: %w", err) + return nil, nil, nil, nil, fmt.Errorf("configure database: %w", err) } - // initialize SSO + // init SSO ssoOpts := pwsso.Opts{ AllowUnsafe: *engineSSOAllowUnsafe, Logger: logger.Named("sso"), @@ -418,29 +423,29 @@ func engineFromFlags() (pwengine.Engine, *gorm.DB, pwsso.Client, func(), error) } sso, err := pwsso.New(*engineSSOPubkey, *engineSSORealm, ssoOpts) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("failed to initialize SSO client: %w", err) + return nil, nil, nil, nil, fmt.Errorf("init SSO client: %w", err) } - // initialize engine + // init engine engineOpts := pwengine.Opts{ Logger: logger.Named("engine"), } engine, err := pwengine.New(db, sso, engineOpts) if err != nil { - return nil, nil, nil, nil, fmt.Errorf("failed to initialize engine: %w", err) + return nil, nil, nil, nil, fmt.Errorf("init engine: %w", err) } closeFunc := func() { if err := engine.Close(); err != nil { - logger.Warn("failed to close engine", zap.Error(err)) + logger.Warn("close engine", zap.Error(err)) } if err := db.Close(); err != nil { - logger.Warn("failed to closed database", zap.Error(err)) + logger.Warn("closed database", zap.Error(err)) } } - logger.Debug("engine initialized", zap.Any("db", db), zap.Any("opts", engineOpts)) + logger.Debug("engine initd", zap.Any("db", db), zap.Any("opts", engineOpts)) return engine, db, sso, closeFunc, nil } @@ -455,7 +460,7 @@ func ssoFromFlags() (pwsso.Client, error) { } sso, err := pwsso.New(*ssoPubkey, *ssoRealm, ssoOpts) if err != nil { - return nil, fmt.Errorf("failed to initialize SSO client: %w", err) + return nil, fmt.Errorf("init SSO client: %w", err) } return sso, nil } diff --git a/go/gen.sum b/go/gen.sum index 816dfcff8..733d4fcab 100644 --- a/go/gen.sum +++ b/go/gen.sum @@ -1,7 +1,7 @@ -09f59024ff101848f270b514de148cc2695ef37d ../api/pwengine.proto 30302d31bca0924719daf9e95a0ea15dfbcfb131 ../api/pwhypervisor.proto +4fff3f10be21a6f7e22254700d86c149e6a06bbb ../api/pwengine.proto 58eb4b1d9b5be40a69ffdab1a13b9fb90b669839 ../api/pwsso.proto +5b457e13e87038fcd3124378fdcef56a458b889b ../api/pwdb.proto 5d333f98cfbafd36ddc97b3c7c364bf94b898384 ../api/pwcompose.proto -7d781f192af7de0062a3d3ef88fbdffa74409813 ../api/pwdb.proto e03a41d6ea8a15cf30dd9d82508e7a8956c33a89 Makefile fb5070d4099e2c7384c026e38f49d73396bcb489 ../api/pwchallenge.proto diff --git a/go/go.mod b/go/go.mod index 2b58c3517..93287b8fd 100644 --- a/go/go.mod +++ b/go/go.mod @@ -2,6 +2,7 @@ module pathwar.land/go require ( github.com/brianvoe/gofakeit v3.18.0+incompatible + github.com/bwmarrin/snowflake v0.3.0 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/go-chi/chi v4.0.2+incompatible github.com/go-sql-driver/mysql v1.4.1 @@ -15,9 +16,7 @@ require ( github.com/keycloak/kcinit v0.0.0-20181010192927-f85c3c5390ea github.com/oklog/run v1.0.0 github.com/peterbourgon/ff v1.6.1-0.20190916204019-6cd704ec2eeb - github.com/pkg/errors v0.8.1 github.com/rs/cors v1.7.0 - github.com/satori/go.uuid v1.2.0 github.com/treastech/logger v0.0.0-20180705232552-e381e9ecf2e3 go.uber.org/multierr v1.2.0 // indirect go.uber.org/zap v1.10.0 diff --git a/go/go.sum b/go/go.sum index 207e1be8e..c5502539f 100644 --- a/go/go.sum +++ b/go/go.sum @@ -14,6 +14,8 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/brianvoe/gofakeit v3.18.0+incompatible h1:wDOmHc9DLG4nRjUVVaxA+CEglKOW72Y5+4WNxUIkjM8= github.com/brianvoe/gofakeit v3.18.0+incompatible/go.mod h1:kfwdRA90vvNhPutZWfH7WPaDzUjz+CZFqG+rPkOjGOc= +github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= +github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -157,8 +159,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= diff --git a/go/internal/testutil/doc.go b/go/internal/testutil/doc.go new file mode 100644 index 000000000..e6cd73f13 --- /dev/null +++ b/go/internal/testutil/doc.go @@ -0,0 +1 @@ +package testutil // import "pathwar.land/go/internal/testutil" diff --git a/go/internal/testutil/logging.go b/go/internal/testutil/logging.go new file mode 100644 index 000000000..4a56c0f03 --- /dev/null +++ b/go/internal/testutil/logging.go @@ -0,0 +1,29 @@ +package testutil + +import ( + "flag" + "testing" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +var debug = flag.Bool("debug", false, "more verbose logging") + +func Logger(t *testing.T) *zap.Logger { + t.Helper() + if !*debug { + return zap.NewNop() + } + + config := zap.NewDevelopmentConfig() + config.DisableStacktrace = true + config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder + config.Level.SetLevel(zap.DebugLevel) + logger, err := config.Build() + if err != nil { + t.Errorf("debug logger: %v", err) + return zap.NewNop() + } + return logger +} diff --git a/go/pkg/pwdb/db.go b/go/pkg/pwdb/db.go index 4152a0959..d0c4efd39 100644 --- a/go/pkg/pwdb/db.go +++ b/go/pkg/pwdb/db.go @@ -1,10 +1,10 @@ package pwdb import ( - "encoding/base64" + "fmt" + "github.com/bwmarrin/snowflake" "github.com/jinzhu/gorm" - uuid "github.com/satori/go.uuid" "go.uber.org/zap" "moul.io/zapgorm" ) @@ -16,33 +16,27 @@ type Opts struct { skipFK bool } -func Configure(db *gorm.DB, opts Opts) (*gorm.DB, error) { +func Configure(db *gorm.DB, sfn *snowflake.Node, opts Opts) (*gorm.DB, error) { db.SetLogger(zapgorm.New(opts.Logger)) //db.Callback().Create().Remove("gorm:update_time_stamp") //db.Callback().Update().Remove("gorm:update_time_stamp") - db.Callback().Create().Before("gorm:create").Register("pathwar_before_create", beforeCreate) + db.Callback().Create().Before("gorm:create").Register("pathwar_before_create", beforeCreate(sfn)) db = db.Set("gorm:auto_preload", false) db = db.Set("gorm:association_autoupdate", false) db.BlockGlobalUpdate(true) db.SingularTable(true) db.LogMode(true) - if err := migrate(db, opts); err != nil { - return nil, err + if err := migrate(db, sfn, opts); err != nil { + return nil, fmt.Errorf("run db migrations: %w", err) } return db, nil } -func beforeCreate(scope *gorm.Scope) { - switch scope.TableName() { - case "user": - return - } - id, err := uuid.NewV4().MarshalBinary() - if err != nil { - panic(err) - } - out := base64.StdEncoding.EncodeToString(id) - if err := scope.SetColumn("ID", out); err != nil { - panic(err) +func beforeCreate(sfn *snowflake.Node) func(*gorm.Scope) { + return func(scope *gorm.Scope) { + id := sfn.Generate().Int64() + if err := scope.SetColumn("ID", id); err != nil { + panic(err) + } } } diff --git a/go/pkg/pwdb/errors.go b/go/pkg/pwdb/errors.go new file mode 100644 index 000000000..6926ff242 --- /dev/null +++ b/go/pkg/pwdb/errors.go @@ -0,0 +1,11 @@ +package pwdb + +import ( + "errors" + + "github.com/jinzhu/gorm" +) + +func IsRecordNotFoundError(err error) bool { + return gorm.IsRecordNotFoundError(errors.Unwrap(err)) +} diff --git a/go/pkg/pwdb/helpers.go b/go/pkg/pwdb/helpers.go index bb847250d..390dd225b 100644 --- a/go/pkg/pwdb/helpers.go +++ b/go/pkg/pwdb/helpers.go @@ -1,14 +1,14 @@ package pwdb import ( - "encoding/base64" - fmt "fmt" + "fmt" "math/rand" "github.com/brianvoe/gofakeit" + "github.com/bwmarrin/snowflake" "github.com/jinzhu/gorm" - uuid "github.com/satori/go.uuid" "go.uber.org/zap" + "pathwar.land/go/internal/randstring" ) func GetInfo(db *gorm.DB, logger *zap.Logger) (*Info, error) { @@ -19,7 +19,7 @@ func GetInfo(db *gorm.DB, logger *zap.Logger) (*Info, error) { var count uint32 tableName := db.NewScope(model).TableName() if err := db.Model(model).Count(&count).Error; err != nil { - logger.Warn("failed to get table rows", zap.String("table", tableName), zap.Error(err)) + logger.Warn("get table rows", zap.String("table", tableName), zap.Error(err)) continue } info.TableRows[tableName] = count @@ -69,7 +69,7 @@ func GetDump(db *gorm.DB) (*Dump, error) { return &dump, nil } -func GenerateFakeData(db *gorm.DB, logger *zap.Logger) error { +func GenerateFakeData(db *gorm.DB, sfn *snowflake.Node, logger *zap.Logger) error { hypervisors := []*Hypervisor{} for i := 0; i < 3; i++ { hypervisor := &Hypervisor{ @@ -130,18 +130,13 @@ func GenerateFakeData(db *gorm.DB, logger *zap.Logger) error { users := []*User{} for i := 0; i < 10; i++ { - id, err := uuid.NewV4().MarshalBinary() - if err != nil { - return fmt.Errorf("failed to generate uuid: %w", err) - } - out := base64.StdEncoding.EncodeToString(id) user := &User{ - ID: out, - Username: gofakeit.Name(), - GravatarURL: gofakeit.ImageURL(400, 400) + "?" + gofakeit.HipsterWord(), - WebsiteURL: gofakeit.URL(), - Locale: "fr_FR", - Memberships: []*TeamMember{}, + Username: gofakeit.Name(), + GravatarURL: gofakeit.ImageURL(400, 400) + "?" + gofakeit.HipsterWord(), + WebsiteURL: gofakeit.URL(), + Locale: "fr_FR", + Memberships: []*TeamMember{}, + OAuthSubject: randstring.RandString(10), } users = append(users, user) } @@ -161,31 +156,31 @@ func GenerateFakeData(db *gorm.DB, logger *zap.Logger) error { logger.Debug("Generating hypervisors") for _, entity := range hypervisors { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create hypervisors: %w", err) + return fmt.Errorf("create hypervisors: %w", err) } } logger.Debug("Generating users") for _, entity := range users { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create users: %w", err) + return fmt.Errorf("create users: %w", err) } } logger.Debug("Generating challenges") for _, entity := range challenges { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create challenges: %w", err) + return fmt.Errorf("create challenges: %w", err) } } logger.Debug("Generating tournaments") for _, entity := range tournaments { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create tournaments: %w", err) + return fmt.Errorf("create tournaments: %w", err) } } logger.Debug("Generating teams") for _, entity := range teams { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create teams: %w", err) + return fmt.Errorf("create teams: %w", err) } } @@ -217,13 +212,13 @@ func GenerateFakeData(db *gorm.DB, logger *zap.Logger) error { logger.Debug("Generating memberships") for _, entity := range memberships { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create memberships: %w", err) + return fmt.Errorf("create memberships: %w", err) } } logger.Debug("Generating coupons") for _, entity := range coupons { if err := db.Set("gorm:association_autoupdate", true).Create(entity).Error; err != nil { - return fmt.Errorf("failed to create coupons: %w", err) + return fmt.Errorf("create coupons: %w", err) } } return nil diff --git a/go/pkg/pwdb/migrations.go b/go/pkg/pwdb/migrations.go index 5db930b1c..6e2e26051 100644 --- a/go/pkg/pwdb/migrations.go +++ b/go/pkg/pwdb/migrations.go @@ -1,11 +1,12 @@ package pwdb import ( + "github.com/bwmarrin/snowflake" "github.com/jinzhu/gorm" "gopkg.in/gormigrate.v1" ) -func migrate(db *gorm.DB, opts Opts) error { +func migrate(db *gorm.DB, sfn *snowflake.Node, opts Opts) error { m := gormigrate.New(db, gormigrate.DefaultOptions, []*gormigrate.Migration{}) // only called on fresh database @@ -24,7 +25,7 @@ func migrate(db *gorm.DB, opts Opts) error { } } - for _, entity := range firstEntities() { + for _, entity := range firstEntities(sfn) { if err := tx.Create(entity).Error; err != nil { tx.Rollback() return err @@ -47,7 +48,7 @@ func migrate(db *gorm.DB, opts Opts) error { return nil } -func firstEntities() []interface{} { +func firstEntities(sfn *snowflake.Node) []interface{} { solo := &Tournament{ // ID: "solo-tournament", Name: "Solo Mode", @@ -61,8 +62,8 @@ func firstEntities() []interface{} { Visibility: Tournament_Public, } m1ch3l := &User{ - ID: "m1ch3l", - Username: "m1ch3l", + Username: "m1ch3l", + OAuthSubject: "m1ch3l", // State: special } staff := &Team{ diff --git a/go/pkg/pwdb/pwdb.pb.go b/go/pkg/pwdb/pwdb.pb.go index 69f0e55fb..e3dccc538 100644 --- a/go/pkg/pwdb/pwdb.pb.go +++ b/go/pkg/pwdb/pwdb.pb.go @@ -407,7 +407,7 @@ func (Achievement_Type) EnumDescriptor() ([]byte, []int) { } type Challenge struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Name string `protobuf:"bytes,100,opt,name=name,proto3" json:"name,omitempty"` @@ -455,11 +455,11 @@ func (m *Challenge) XXX_DiscardUnknown() { var xxx_messageInfo_Challenge proto.InternalMessageInfo -func (m *Challenge) GetID() string { +func (m *Challenge) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Challenge) GetCreatedAt() *time.Time { @@ -577,7 +577,7 @@ func (m *ChallengeList) GetItems() []*Challenge { } type ChallengeVersion struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Version string `protobuf:"bytes,100,opt,name=version,proto3" json:"version,omitempty"` @@ -587,7 +587,7 @@ type ChallengeVersion struct { SourceURL string `protobuf:"bytes,104,opt,name=source_url,json=sourceUrl,proto3" json:"source_url,omitempty"` Driver ChallengeVersion_Driver `protobuf:"varint,105,opt,name=driver,proto3,enum=pathwar.db.ChallengeVersion_Driver" json:"driver,omitempty"` Challenge *Challenge `protobuf:"bytes,200,opt,name=challenge,proto3" json:"challenge,omitempty" gorm:"foreignkey:ChallengeID"` - ChallengeID string `protobuf:"bytes,201,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty" sql:"not null" gorm:"index"` + ChallengeID int64 `protobuf:"varint,201,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty" sql:"not null" gorm:"index"` Flavors []*ChallengeFlavor `protobuf:"bytes,202,rep,name=flavors,proto3" json:"flavors,omitempty" gorm:"PRELOAD:false"` } @@ -624,11 +624,11 @@ func (m *ChallengeVersion) XXX_DiscardUnknown() { var xxx_messageInfo_ChallengeVersion proto.InternalMessageInfo -func (m *ChallengeVersion) GetID() string { +func (m *ChallengeVersion) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *ChallengeVersion) GetCreatedAt() *time.Time { @@ -694,11 +694,11 @@ func (m *ChallengeVersion) GetChallenge() *Challenge { return nil } -func (m *ChallengeVersion) GetChallengeID() string { +func (m *ChallengeVersion) GetChallengeID() int64 { if m != nil { return m.ChallengeID } - return "" + return 0 } func (m *ChallengeVersion) GetFlavors() []*ChallengeFlavor { @@ -709,11 +709,11 @@ func (m *ChallengeVersion) GetFlavors() []*ChallengeFlavor { } type ChallengeFlavor struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` - ChallengeVersion *Challenge `protobuf:"bytes,200,opt,name=challenge_version,json=challengeVersion,proto3" json:"challenge_version,omitempty" gorm:"foreignkey:ChallengeVersionID"` - ChallengeVersionID string `protobuf:"bytes,201,opt,name=challenge_version_id,json=challengeVersionId,proto3" json:"challenge_version_id,omitempty" sql:"not null" gorm:"index"` + ChallengeVersion *ChallengeVersion `protobuf:"bytes,200,opt,name=challenge_version,json=challengeVersion,proto3" json:"challenge_version,omitempty" gorm:"foreignkey:ChallengeVersionID"` + ChallengeVersionID int64 `protobuf:"varint,201,opt,name=challenge_version_id,json=challengeVersionId,proto3" json:"challenge_version_id,omitempty" sql:"not null" gorm:"index"` Instances []*ChallengeInstance `protobuf:"bytes,202,rep,name=instances,proto3" json:"instances,omitempty" gorm:"PRELOAD:false"` } @@ -750,11 +750,11 @@ func (m *ChallengeFlavor) XXX_DiscardUnknown() { var xxx_messageInfo_ChallengeFlavor proto.InternalMessageInfo -func (m *ChallengeFlavor) GetID() string { +func (m *ChallengeFlavor) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *ChallengeFlavor) GetCreatedAt() *time.Time { @@ -771,18 +771,18 @@ func (m *ChallengeFlavor) GetUpdatedAt() *time.Time { return nil } -func (m *ChallengeFlavor) GetChallengeVersion() *Challenge { +func (m *ChallengeFlavor) GetChallengeVersion() *ChallengeVersion { if m != nil { return m.ChallengeVersion } return nil } -func (m *ChallengeFlavor) GetChallengeVersionID() string { +func (m *ChallengeFlavor) GetChallengeVersionID() int64 { if m != nil { return m.ChallengeVersionID } - return "" + return 0 } func (m *ChallengeFlavor) GetInstances() []*ChallengeInstance { @@ -793,14 +793,14 @@ func (m *ChallengeFlavor) GetInstances() []*ChallengeInstance { } type ChallengeInstance struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Status ChallengeInstance_Status `protobuf:"varint,100,opt,name=status,proto3,enum=pathwar.db.ChallengeInstance_Status" json:"status,omitempty"` Hypervisor *Hypervisor `protobuf:"bytes,200,opt,name=hypervisor,proto3" json:"hypervisor,omitempty" gorm:"foreignkey:HypervisorID"` - HypervisorID string `protobuf:"bytes,201,opt,name=hypervisor_id,json=hypervisorId,proto3" json:"hypervisor_id,omitempty" sql:"not null" gorm:"index"` + HypervisorID int64 `protobuf:"varint,201,opt,name=hypervisor_id,json=hypervisorId,proto3" json:"hypervisor_id,omitempty" sql:"not null" gorm:"index"` Flavor *ChallengeFlavor `protobuf:"bytes,202,opt,name=flavor,proto3" json:"flavor,omitempty" gorm:"foreignkey:FlavorID"` - FlavorID string `protobuf:"bytes,203,opt,name=flavor_id,json=flavorId,proto3" json:"flavor_id,omitempty" sql:"not null" gorm:"index"` + FlavorID int64 `protobuf:"varint,203,opt,name=flavor_id,json=flavorId,proto3" json:"flavor_id,omitempty" sql:"not null" gorm:"index"` } func (m *ChallengeInstance) Reset() { *m = ChallengeInstance{} } @@ -836,11 +836,11 @@ func (m *ChallengeInstance) XXX_DiscardUnknown() { var xxx_messageInfo_ChallengeInstance proto.InternalMessageInfo -func (m *ChallengeInstance) GetID() string { +func (m *ChallengeInstance) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *ChallengeInstance) GetCreatedAt() *time.Time { @@ -871,11 +871,11 @@ func (m *ChallengeInstance) GetHypervisor() *Hypervisor { return nil } -func (m *ChallengeInstance) GetHypervisorID() string { +func (m *ChallengeInstance) GetHypervisorID() int64 { if m != nil { return m.HypervisorID } - return "" + return 0 } func (m *ChallengeInstance) GetFlavor() *ChallengeFlavor { @@ -885,15 +885,15 @@ func (m *ChallengeInstance) GetFlavor() *ChallengeFlavor { return nil } -func (m *ChallengeInstance) GetFlavorID() string { +func (m *ChallengeInstance) GetFlavorID() int64 { if m != nil { return m.FlavorID } - return "" + return 0 } type Hypervisor struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Name string `protobuf:"bytes,100,opt,name=name,proto3" json:"name,omitempty"` @@ -935,11 +935,11 @@ func (m *Hypervisor) XXX_DiscardUnknown() { var xxx_messageInfo_Hypervisor proto.InternalMessageInfo -func (m *Hypervisor) GetID() string { +func (m *Hypervisor) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Hypervisor) GetCreatedAt() *time.Time { @@ -985,14 +985,14 @@ func (m *Hypervisor) GetChallengeInstances() []*ChallengeInstance { } type TeamMember struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Role TeamMember_Role `protobuf:"varint,100,opt,name=role,proto3,enum=pathwar.db.TeamMember_Role" json:"role,omitempty"` User *User `protobuf:"bytes,200,opt,name=user,proto3" json:"user,omitempty" gorm:"foreignkey:UserID"` - UserID string `protobuf:"bytes,201,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" sql:"not null" gorm:"index"` + UserID int64 `protobuf:"varint,201,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" sql:"not null" gorm:"index"` Team *Team `protobuf:"bytes,202,opt,name=team,proto3" json:"team,omitempty" gorm:"foreignkey:TeamID"` - TeamID string `protobuf:"bytes,203,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty" sql:"not null" gorm:"index"` + TeamID int64 `protobuf:"varint,203,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty" sql:"not null" gorm:"index"` } func (m *TeamMember) Reset() { *m = TeamMember{} } @@ -1028,11 +1028,11 @@ func (m *TeamMember) XXX_DiscardUnknown() { var xxx_messageInfo_TeamMember proto.InternalMessageInfo -func (m *TeamMember) GetID() string { +func (m *TeamMember) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *TeamMember) GetCreatedAt() *time.Time { @@ -1063,11 +1063,11 @@ func (m *TeamMember) GetUser() *User { return nil } -func (m *TeamMember) GetUserID() string { +func (m *TeamMember) GetUserID() int64 { if m != nil { return m.UserID } - return "" + return 0 } func (m *TeamMember) GetTeam() *Team { @@ -1077,22 +1077,22 @@ func (m *TeamMember) GetTeam() *Team { return nil } -func (m *TeamMember) GetTeamID() string { +func (m *TeamMember) GetTeamID() int64 { if m != nil { return m.TeamID } - return "" + return 0 } type TournamentMember struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Role TournamentMember_Role `protobuf:"varint,100,opt,name=role,proto3,enum=pathwar.db.TournamentMember_Role" json:"role,omitempty"` User *User `protobuf:"bytes,200,opt,name=user,proto3" json:"user,omitempty" gorm:"foreignkey:UserID"` - UserID string `protobuf:"bytes,201,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" sql:"not null" gorm:"index"` + UserID int64 `protobuf:"varint,201,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" sql:"not null" gorm:"index"` TournamentTeam *TournamentTeam `protobuf:"bytes,202,opt,name=tournament_team,json=tournamentTeam,proto3" json:"tournament_team,omitempty" gorm:"foreignkey:TournamentTeamID"` - TournamentTeamID string `protobuf:"bytes,203,opt,name=tournament_team_id,json=tournamentTeamId,proto3" json:"tournament_team_id,omitempty" sql:"not null" gorm:"index"` + TournamentTeamID int64 `protobuf:"varint,203,opt,name=tournament_team_id,json=tournamentTeamId,proto3" json:"tournament_team_id,omitempty" sql:"not null" gorm:"index"` Coupons []*Coupon `protobuf:"bytes,204,rep,name=coupons,proto3" json:"coupons,omitempty" gorm:"PRELOAD:false"` Achievements []*Achievement `protobuf:"bytes,205,rep,name=achievements,proto3" json:"achievements,omitempty" gorm:"PRELOAD:false"` SentWhoswhoAttempts []*WhoswhoAttempt `protobuf:"bytes,206,rep,name=sent_whoswho_attempts,json=sentWhoswhoAttempts,proto3" json:"sent_whoswho_attempts,omitempty" gorm:"PRELOAD:false"` @@ -1134,11 +1134,11 @@ func (m *TournamentMember) XXX_DiscardUnknown() { var xxx_messageInfo_TournamentMember proto.InternalMessageInfo -func (m *TournamentMember) GetID() string { +func (m *TournamentMember) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *TournamentMember) GetCreatedAt() *time.Time { @@ -1169,11 +1169,11 @@ func (m *TournamentMember) GetUser() *User { return nil } -func (m *TournamentMember) GetUserID() string { +func (m *TournamentMember) GetUserID() int64 { if m != nil { return m.UserID } - return "" + return 0 } func (m *TournamentMember) GetTournamentTeam() *TournamentTeam { @@ -1183,11 +1183,11 @@ func (m *TournamentMember) GetTournamentTeam() *TournamentTeam { return nil } -func (m *TournamentMember) GetTournamentTeamID() string { +func (m *TournamentMember) GetTournamentTeamID() int64 { if m != nil { return m.TournamentTeamID } - return "" + return 0 } func (m *TournamentMember) GetCoupons() []*Coupon { @@ -1234,7 +1234,7 @@ func (m *TournamentMember) GetChallengeValidations() []*ChallengeValidation { // User defines a User Account / Profile type User struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Username string `protobuf:"bytes,100,opt,name=username,proto3" json:"username,omitempty"` @@ -1242,13 +1242,14 @@ type User struct { GravatarURL string `protobuf:"bytes,102,opt,name=gravatar_url,json=gravatarUrl,proto3" json:"gravatar_url,omitempty"` WebsiteURL string `protobuf:"bytes,103,opt,name=website_url,json=websiteUrl,proto3" json:"website_url,omitempty"` Locale string `protobuf:"bytes,104,opt,name=locale,proto3" json:"locale,omitempty"` + OAuthSubject string `protobuf:"bytes,105,opt,name=oauth_subject,json=oauthSubject,proto3" json:"oauth_subject,omitempty" gorm:"unique_index"` TournamentMemberships []*TournamentMember `protobuf:"bytes,200,rep,name=tournament_memberships,json=tournamentMemberships,proto3" json:"tournament_memberships,omitempty" gorm:"PRELOAD:false"` Notifications []*Notification `protobuf:"bytes,201,rep,name=notifications,proto3" json:"notifications,omitempty" gorm:"PRELOAD:false"` Memberships []*TeamMember `protobuf:"bytes,202,rep,name=memberships,proto3" json:"memberships,omitempty" gorm:"PRELOAD:false"` ActiveTournamentMember *TournamentMember `protobuf:"bytes,203,opt,name=active_tournament_member,json=activeTournamentMember,proto3" json:"active_tournament_member,omitempty" gorm:"foreignkey:ActiveTournamentMemberID;PRELOAD:false"` - ActiveTournamentMemberID string `protobuf:"bytes,204,opt,name=active_tournament_member_id,json=activeTournamentMemberId,proto3" json:"active_tournament_member_id,omitempty" sql:"not null" gorm:"index"` + ActiveTournamentMemberID int64 `protobuf:"varint,204,opt,name=active_tournament_member_id,json=activeTournamentMemberId,proto3" json:"active_tournament_member_id,omitempty" sql:"not null" gorm:"index"` ActiveTournament *TournamentMember `protobuf:"bytes,205,opt,name=active_tournament,json=activeTournament,proto3" json:"active_tournament,omitempty" gorm:"foreignkey:ActiveTournamentID;PRELOAD:false"` - ActiveTournamentID string `protobuf:"bytes,206,opt,name=active_tournament_id,json=activeTournamentId,proto3" json:"active_tournament_id,omitempty" sql:"not null" gorm:"index"` + ActiveTournamentID int64 `protobuf:"varint,206,opt,name=active_tournament_id,json=activeTournamentId,proto3" json:"active_tournament_id,omitempty" sql:"not null" gorm:"index"` } func (m *User) Reset() { *m = User{} } @@ -1284,11 +1285,11 @@ func (m *User) XXX_DiscardUnknown() { var xxx_messageInfo_User proto.InternalMessageInfo -func (m *User) GetID() string { +func (m *User) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *User) GetCreatedAt() *time.Time { @@ -1340,6 +1341,13 @@ func (m *User) GetLocale() string { return "" } +func (m *User) GetOAuthSubject() string { + if m != nil { + return m.OAuthSubject + } + return "" +} + func (m *User) GetTournamentMemberships() []*TournamentMember { if m != nil { return m.TournamentMemberships @@ -1368,11 +1376,11 @@ func (m *User) GetActiveTournamentMember() *TournamentMember { return nil } -func (m *User) GetActiveTournamentMemberID() string { +func (m *User) GetActiveTournamentMemberID() int64 { if m != nil { return m.ActiveTournamentMemberID } - return "" + return 0 } func (m *User) GetActiveTournament() *TournamentMember { @@ -1382,11 +1390,11 @@ func (m *User) GetActiveTournament() *TournamentMember { return nil } -func (m *User) GetActiveTournamentID() string { +func (m *User) GetActiveTournamentID() int64 { if m != nil { return m.ActiveTournamentID } - return "" + return 0 } type UserList struct { @@ -1434,7 +1442,7 @@ func (m *UserList) GetItems() []*User { } type Team struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Name string `protobuf:"bytes,100,opt,name=name,proto3" json:"name,omitempty"` @@ -1478,11 +1486,11 @@ func (m *Team) XXX_DiscardUnknown() { var xxx_messageInfo_Team proto.InternalMessageInfo -func (m *Team) GetID() string { +func (m *Team) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Team) GetCreatedAt() *time.Time { @@ -1586,7 +1594,7 @@ func (m *TeamList) GetItems() []*Team { } type Tournament struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Name string `protobuf:"bytes,100,opt,name=name,proto3" json:"name,omitempty"` @@ -1630,11 +1638,11 @@ func (m *Tournament) XXX_DiscardUnknown() { var xxx_messageInfo_Tournament proto.InternalMessageInfo -func (m *Tournament) GetID() string { +func (m *Tournament) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Tournament) GetCreatedAt() *time.Time { @@ -1738,14 +1746,14 @@ func (m *TournamentList) GetItems() []*Tournament { } type TournamentTeam struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` IsDefault bool `protobuf:"varint,100,opt,name=is_default,json=isDefault,proto3" json:"is_default,omitempty"` Tournament *Tournament `protobuf:"bytes,200,opt,name=tournament,proto3" json:"tournament,omitempty" gorm:"foreignkey:TournamentID"` - TournamentID string `protobuf:"bytes,201,opt,name=tournament_id,json=tournamentId,proto3" json:"tournament_id,omitempty" sql:"not null" gorm:"index"` + TournamentID int64 `protobuf:"varint,201,opt,name=tournament_id,json=tournamentId,proto3" json:"tournament_id,omitempty" sql:"not null" gorm:"index"` Team *Team `protobuf:"bytes,202,opt,name=team,proto3" json:"team,omitempty" gorm:"foreignkey:TeamID"` - TeamID string `protobuf:"bytes,203,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty" sql:"not null" gorm:"index"` + TeamID int64 `protobuf:"varint,203,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty" sql:"not null" gorm:"index"` ChallengeSubscriptions []*ChallengeSubscription `protobuf:"bytes,205,rep,name=challenge_subscriptions,json=challengeSubscriptions,proto3" json:"challenge_subscriptions,omitempty" gorm:"PRELOAD:false"` Members []*TournamentMember `protobuf:"bytes,206,rep,name=members,proto3" json:"members,omitempty" gorm:"PRELOAD:false"` } @@ -1783,11 +1791,11 @@ func (m *TournamentTeam) XXX_DiscardUnknown() { var xxx_messageInfo_TournamentTeam proto.InternalMessageInfo -func (m *TournamentTeam) GetID() string { +func (m *TournamentTeam) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *TournamentTeam) GetCreatedAt() *time.Time { @@ -1818,11 +1826,11 @@ func (m *TournamentTeam) GetTournament() *Tournament { return nil } -func (m *TournamentTeam) GetTournamentID() string { +func (m *TournamentTeam) GetTournamentID() int64 { if m != nil { return m.TournamentID } - return "" + return 0 } func (m *TournamentTeam) GetTeam() *Team { @@ -1832,11 +1840,11 @@ func (m *TournamentTeam) GetTeam() *Team { return nil } -func (m *TournamentTeam) GetTeamID() string { +func (m *TournamentTeam) GetTeamID() int64 { if m != nil { return m.TeamID } - return "" + return 0 } func (m *TournamentTeam) GetChallengeSubscriptions() []*ChallengeSubscription { @@ -1898,7 +1906,7 @@ func (m *TournamentTeamList) GetItems() []*TournamentTeam { } type WhoswhoAttempt struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` // @@ -1909,11 +1917,11 @@ type WhoswhoAttempt struct { // associations // Author *TournamentMember `protobuf:"bytes,200,opt,name=author,proto3" json:"author,omitempty" sql:"not null" gorm:"foreignkey:AuthorID"` - AuthorID string `protobuf:"bytes,201,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty" sql:"not null" gorm:"index"` + AuthorID int64 `protobuf:"varint,201,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty" sql:"not null" gorm:"index"` TargetMember *TournamentMember `protobuf:"bytes,202,opt,name=target_member,json=targetMember,proto3" json:"target_member,omitempty" sql:"not null" gorm:"foreignkey:TargetMemberID"` - TargetMemberID string `protobuf:"bytes,203,opt,name=target_member_id,json=targetMemberId,proto3" json:"target_member_id,omitempty" sql:"not null" gorm:"index"` + TargetMemberID int64 `protobuf:"varint,203,opt,name=target_member_id,json=targetMemberId,proto3" json:"target_member_id,omitempty" sql:"not null" gorm:"index"` TargetTeam *TournamentTeam `protobuf:"bytes,204,opt,name=target_team,json=targetTeam,proto3" json:"target_team,omitempty" sql:"not null" gorm:"foreignkey:TargetTeamID"` - TargetTeamID string `protobuf:"bytes,205,opt,name=target_team_id,json=targetTeamId,proto3" json:"target_team_id,omitempty" sql:"not null" gorm:"index"` + TargetTeamID int64 `protobuf:"varint,205,opt,name=target_team_id,json=targetTeamId,proto3" json:"target_team_id,omitempty" sql:"not null" gorm:"index"` } func (m *WhoswhoAttempt) Reset() { *m = WhoswhoAttempt{} } @@ -1949,11 +1957,11 @@ func (m *WhoswhoAttempt) XXX_DiscardUnknown() { var xxx_messageInfo_WhoswhoAttempt proto.InternalMessageInfo -func (m *WhoswhoAttempt) GetID() string { +func (m *WhoswhoAttempt) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *WhoswhoAttempt) GetCreatedAt() *time.Time { @@ -1984,11 +1992,11 @@ func (m *WhoswhoAttempt) GetAuthor() *TournamentMember { return nil } -func (m *WhoswhoAttempt) GetAuthorID() string { +func (m *WhoswhoAttempt) GetAuthorID() int64 { if m != nil { return m.AuthorID } - return "" + return 0 } func (m *WhoswhoAttempt) GetTargetMember() *TournamentMember { @@ -1998,11 +2006,11 @@ func (m *WhoswhoAttempt) GetTargetMember() *TournamentMember { return nil } -func (m *WhoswhoAttempt) GetTargetMemberID() string { +func (m *WhoswhoAttempt) GetTargetMemberID() int64 { if m != nil { return m.TargetMemberID } - return "" + return 0 } func (m *WhoswhoAttempt) GetTargetTeam() *TournamentTeam { @@ -2012,24 +2020,24 @@ func (m *WhoswhoAttempt) GetTargetTeam() *TournamentTeam { return nil } -func (m *WhoswhoAttempt) GetTargetTeamID() string { +func (m *WhoswhoAttempt) GetTargetTeamID() int64 { if m != nil { return m.TargetTeamID } - return "" + return 0 } type ChallengeValidation struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Status ChallengeValidation_Status `protobuf:"varint,100,opt,name=status,proto3,enum=pathwar.db.ChallengeValidation_Status" json:"status,omitempty"` AuthorComment string `protobuf:"bytes,101,opt,name=author_comment,json=authorComment,proto3" json:"author_comment,omitempty"` CorrectorComment string `protobuf:"bytes,102,opt,name=corrector_comment,json=correctorComment,proto3" json:"corrector_comment,omitempty"` ChallengeSubscription *ChallengeSubscription `protobuf:"bytes,200,opt,name=challenge_subscription,json=challengeSubscription,proto3" json:"challenge_subscription,omitempty" gorm:"foreignkey:ChallengeSubscriptionID"` - ChallengeSubscriptionID string `protobuf:"bytes,201,opt,name=challenge_subscription_id,json=challengeSubscriptionId,proto3" json:"challenge_subscription_id,omitempty" sql:"not null" gorm:"index"` + ChallengeSubscriptionID int64 `protobuf:"varint,201,opt,name=challenge_subscription_id,json=challengeSubscriptionId,proto3" json:"challenge_subscription_id,omitempty" sql:"not null" gorm:"index"` TournamentMember *TournamentMember `protobuf:"bytes,202,opt,name=tournament_member,json=tournamentMember,proto3" json:"tournament_member,omitempty" gorm:"foreignkey:TournamentMemberID"` - TournamentMemberID string `protobuf:"bytes,203,opt,name=tournament_member_id,json=tournamentMemberId,proto3" json:"tournament_member_id,omitempty" sql:"not null" gorm:"index"` + TournamentMemberID int64 `protobuf:"varint,203,opt,name=tournament_member_id,json=tournamentMemberId,proto3" json:"tournament_member_id,omitempty" sql:"not null" gorm:"index"` } func (m *ChallengeValidation) Reset() { *m = ChallengeValidation{} } @@ -2065,11 +2073,11 @@ func (m *ChallengeValidation) XXX_DiscardUnknown() { var xxx_messageInfo_ChallengeValidation proto.InternalMessageInfo -func (m *ChallengeValidation) GetID() string { +func (m *ChallengeValidation) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *ChallengeValidation) GetCreatedAt() *time.Time { @@ -2114,11 +2122,11 @@ func (m *ChallengeValidation) GetChallengeSubscription() *ChallengeSubscription return nil } -func (m *ChallengeValidation) GetChallengeSubscriptionID() string { +func (m *ChallengeValidation) GetChallengeSubscriptionID() int64 { if m != nil { return m.ChallengeSubscriptionID } - return "" + return 0 } func (m *ChallengeValidation) GetTournamentMember() *TournamentMember { @@ -2128,21 +2136,21 @@ func (m *ChallengeValidation) GetTournamentMember() *TournamentMember { return nil } -func (m *ChallengeValidation) GetTournamentMemberID() string { +func (m *ChallengeValidation) GetTournamentMemberID() int64 { if m != nil { return m.TournamentMemberID } - return "" + return 0 } type ChallengeSubscription struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` TournamentTeam *TournamentTeam `protobuf:"bytes,200,opt,name=tournament_team,json=tournamentTeam,proto3" json:"tournament_team,omitempty" gorm:"foreignkey:TournamentTeamID"` - TournamentTeamID string `protobuf:"bytes,201,opt,name=tournament_team_id,json=tournamentTeamId,proto3" json:"tournament_team_id,omitempty" sql:"not null" gorm:"index"` + TournamentTeamID int64 `protobuf:"varint,201,opt,name=tournament_team_id,json=tournamentTeamId,proto3" json:"tournament_team_id,omitempty" sql:"not null" gorm:"index"` ChallengeFlavor *ChallengeFlavor `protobuf:"bytes,202,opt,name=challenge_flavor,json=challengeFlavor,proto3" json:"challenge_flavor,omitempty" gorm:"foreignkey:ChallengeFlavorID"` - ChallengeFlavorID string `protobuf:"bytes,203,opt,name=challenge_flavor_id,json=challengeFlavorId,proto3" json:"challenge_flavor_id,omitempty" sql:"not null" gorm:"index"` + ChallengeFlavorID int64 `protobuf:"varint,203,opt,name=challenge_flavor_id,json=challengeFlavorId,proto3" json:"challenge_flavor_id,omitempty" sql:"not null" gorm:"index"` Validations []*ChallengeValidation `protobuf:"bytes,204,rep,name=validations,proto3" json:"validations,omitempty" gorm:"PRELOAD:false"` } @@ -2179,11 +2187,11 @@ func (m *ChallengeSubscription) XXX_DiscardUnknown() { var xxx_messageInfo_ChallengeSubscription proto.InternalMessageInfo -func (m *ChallengeSubscription) GetID() string { +func (m *ChallengeSubscription) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *ChallengeSubscription) GetCreatedAt() *time.Time { @@ -2207,11 +2215,11 @@ func (m *ChallengeSubscription) GetTournamentTeam() *TournamentTeam { return nil } -func (m *ChallengeSubscription) GetTournamentTeamID() string { +func (m *ChallengeSubscription) GetTournamentTeamID() int64 { if m != nil { return m.TournamentTeamID } - return "" + return 0 } func (m *ChallengeSubscription) GetChallengeFlavor() *ChallengeFlavor { @@ -2221,11 +2229,11 @@ func (m *ChallengeSubscription) GetChallengeFlavor() *ChallengeFlavor { return nil } -func (m *ChallengeSubscription) GetChallengeFlavorID() string { +func (m *ChallengeSubscription) GetChallengeFlavorID() int64 { if m != nil { return m.ChallengeFlavorID } - return "" + return 0 } func (m *ChallengeSubscription) GetValidations() []*ChallengeValidation { @@ -2236,12 +2244,12 @@ func (m *ChallengeSubscription) GetValidations() []*ChallengeValidation { } type InventoryItem struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Item InventoryItem_Item `protobuf:"varint,100,opt,name=item,proto3,enum=pathwar.db.InventoryItem_Item" json:"item,omitempty"` Owner *TournamentMember `protobuf:"bytes,200,opt,name=owner,proto3" json:"owner,omitempty" gorm:"foreignkey:OwnerID"` - OwnerID string `protobuf:"bytes,201,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty" sql:"not null" gorm:"index"` + OwnerID int64 `protobuf:"varint,201,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty" sql:"not null" gorm:"index"` } func (m *InventoryItem) Reset() { *m = InventoryItem{} } @@ -2277,11 +2285,11 @@ func (m *InventoryItem) XXX_DiscardUnknown() { var xxx_messageInfo_InventoryItem proto.InternalMessageInfo -func (m *InventoryItem) GetID() string { +func (m *InventoryItem) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *InventoryItem) GetCreatedAt() *time.Time { @@ -2312,15 +2320,15 @@ func (m *InventoryItem) GetOwner() *TournamentMember { return nil } -func (m *InventoryItem) GetOwnerID() string { +func (m *InventoryItem) GetOwnerID() int64 { if m != nil { return m.OwnerID } - return "" + return 0 } type Notification struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` IsRead bool `protobuf:"varint,100,opt,name=is_read,json=isRead,proto3" json:"is_read,omitempty"` @@ -2328,7 +2336,7 @@ type Notification struct { Msg string `protobuf:"bytes,102,opt,name=msg,proto3" json:"msg,omitempty"` Args string `protobuf:"bytes,103,opt,name=args,proto3" json:"args,omitempty"` User *User `protobuf:"bytes,200,opt,name=user,proto3" json:"user,omitempty" gorm:"foreignkey:UserID"` - UserID string `protobuf:"bytes,201,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" sql:"not null" gorm:"index"` + UserID int64 `protobuf:"varint,201,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty" sql:"not null" gorm:"index"` } func (m *Notification) Reset() { *m = Notification{} } @@ -2364,11 +2372,11 @@ func (m *Notification) XXX_DiscardUnknown() { var xxx_messageInfo_Notification proto.InternalMessageInfo -func (m *Notification) GetID() string { +func (m *Notification) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Notification) GetCreatedAt() *time.Time { @@ -2420,15 +2428,15 @@ func (m *Notification) GetUser() *User { return nil } -func (m *Notification) GetUserID() string { +func (m *Notification) GetUserID() int64 { if m != nil { return m.UserID } - return "" + return 0 } type Coupon struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` // @@ -2441,7 +2449,7 @@ type Coupon struct { // associations // Tournament *Tournament `protobuf:"bytes,200,opt,name=tournament,proto3" json:"tournament,omitempty" gorm:"foreignkey:TournamentID"` - TournamentID string `protobuf:"bytes,201,opt,name=tournament_id,json=tournamentId,proto3" json:"tournament_id,omitempty" gorm:"index"` + TournamentID int64 `protobuf:"varint,201,opt,name=tournament_id,json=tournamentId,proto3" json:"tournament_id,omitempty" gorm:"index"` Validations []*CouponValidation `protobuf:"bytes,202,rep,name=validations,proto3" json:"validations,omitempty" gorm:"PRELOAD:false"` } @@ -2478,11 +2486,11 @@ func (m *Coupon) XXX_DiscardUnknown() { var xxx_messageInfo_Coupon proto.InternalMessageInfo -func (m *Coupon) GetID() string { +func (m *Coupon) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Coupon) GetCreatedAt() *time.Time { @@ -2527,11 +2535,11 @@ func (m *Coupon) GetTournament() *Tournament { return nil } -func (m *Coupon) GetTournamentID() string { +func (m *Coupon) GetTournamentID() int64 { if m != nil { return m.TournamentID } - return "" + return 0 } func (m *Coupon) GetValidations() []*CouponValidation { @@ -2542,7 +2550,7 @@ func (m *Coupon) GetValidations() []*CouponValidation { } type CouponValidation struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` // @@ -2553,9 +2561,9 @@ type CouponValidation struct { // associations // Author *TournamentMember `protobuf:"bytes,200,opt,name=author,proto3" json:"author,omitempty" gorm:"foreignkey:AuthorID"` - AuthorID string `protobuf:"bytes,201,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty" sql:"not null" gorm:"index"` + AuthorID int64 `protobuf:"varint,201,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty" sql:"not null" gorm:"index"` Coupon *Coupon `protobuf:"bytes,202,opt,name=coupon,proto3" json:"coupon,omitempty" gorm:"foreignkey:CouponID"` - CouponID string `protobuf:"bytes,203,opt,name=coupon_id,json=couponId,proto3" json:"coupon_id,omitempty" sql:"not null" gorm:"index"` + CouponID int64 `protobuf:"varint,203,opt,name=coupon_id,json=couponId,proto3" json:"coupon_id,omitempty" sql:"not null" gorm:"index"` } func (m *CouponValidation) Reset() { *m = CouponValidation{} } @@ -2591,11 +2599,11 @@ func (m *CouponValidation) XXX_DiscardUnknown() { var xxx_messageInfo_CouponValidation proto.InternalMessageInfo -func (m *CouponValidation) GetID() string { +func (m *CouponValidation) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *CouponValidation) GetCreatedAt() *time.Time { @@ -2626,11 +2634,11 @@ func (m *CouponValidation) GetAuthor() *TournamentMember { return nil } -func (m *CouponValidation) GetAuthorID() string { +func (m *CouponValidation) GetAuthorID() int64 { if m != nil { return m.AuthorID } - return "" + return 0 } func (m *CouponValidation) GetCoupon() *Coupon { @@ -2640,15 +2648,15 @@ func (m *CouponValidation) GetCoupon() *Coupon { return nil } -func (m *CouponValidation) GetCouponID() string { +func (m *CouponValidation) GetCouponID() int64 { if m != nil { return m.CouponID } - return "" + return 0 } type Achievement struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` + ID int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primary_key"` CreatedAt *time.Time `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at,omitempty"` UpdatedAt *time.Time `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at,omitempty"` Type Achievement_Type `protobuf:"varint,100,opt,name=type,proto3,enum=pathwar.db.Achievement_Type" json:"type,omitempty"` @@ -2656,9 +2664,9 @@ type Achievement struct { Comment string `protobuf:"bytes,102,opt,name=comment,proto3" json:"comment,omitempty"` Argument string `protobuf:"bytes,103,opt,name=argument,proto3" json:"argument,omitempty"` Author *TournamentMember `protobuf:"bytes,200,opt,name=author,proto3" json:"author,omitempty" gorm:"foreignkey:AuthorID"` - AuthorID string `protobuf:"bytes,201,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty" sql:"not null" gorm:"index"` + AuthorID int64 `protobuf:"varint,201,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty" sql:"not null" gorm:"index"` ChallengeValidation *ChallengeValidation `protobuf:"bytes,202,opt,name=challenge_validation,json=challengeValidation,proto3" json:"challenge_validation,omitempty" gorm:"foreignkey:ChallengeValidationID"` - ChallengeValidationID string `protobuf:"bytes,203,opt,name=challenge_validation_id,json=challengeValidationId,proto3" json:"challenge_validation_id,omitempty" sql:"not null" gorm:"index"` + ChallengeValidationID int64 `protobuf:"varint,203,opt,name=challenge_validation_id,json=challengeValidationId,proto3" json:"challenge_validation_id,omitempty" sql:"not null" gorm:"index"` } func (m *Achievement) Reset() { *m = Achievement{} } @@ -2694,11 +2702,11 @@ func (m *Achievement) XXX_DiscardUnknown() { var xxx_messageInfo_Achievement proto.InternalMessageInfo -func (m *Achievement) GetID() string { +func (m *Achievement) GetID() int64 { if m != nil { return m.ID } - return "" + return 0 } func (m *Achievement) GetCreatedAt() *time.Time { @@ -2750,11 +2758,11 @@ func (m *Achievement) GetAuthor() *TournamentMember { return nil } -func (m *Achievement) GetAuthorID() string { +func (m *Achievement) GetAuthorID() int64 { if m != nil { return m.AuthorID } - return "" + return 0 } func (m *Achievement) GetChallengeValidation() *ChallengeValidation { @@ -2764,11 +2772,11 @@ func (m *Achievement) GetChallengeValidation() *ChallengeValidation { return nil } -func (m *Achievement) GetChallengeValidationID() string { +func (m *Achievement) GetChallengeValidationID() int64 { if m != nil { return m.ChallengeValidationID } - return "" + return 0 } type Dump struct { @@ -3046,230 +3054,233 @@ func init() { func init() { proto.RegisterFile("pwdb.proto", fileDescriptor_debbe06253822cef) } var fileDescriptor_debbe06253822cef = []byte{ - // 3567 bytes of a gzipped FileDescriptorProto - 0x1f, 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0xba, 0x0d, 0xcd, 0xb1, 0xb0, 0xc6, 0x18, 0xd1, 0x63, 0x28, - 0x76, 0x08, 0x8e, 0xec, 0x87, 0x24, 0xb6, 0x38, 0x22, 0xd8, 0xdd, 0xbb, 0xd9, 0xf7, 0x15, 0x79, - 0x60, 0x13, 0xd2, 0x2a, 0xba, 0x05, 0x59, 0x63, 0xf4, 0x18, 0x26, 0xe9, 0x7f, 0xc1, 0x4e, 0xbc, - 0xde, 0xf3, 0x95, 0x09, 0xce, 0x94, 0xb7, 0xf9, 0x26, 0x68, 0xd3, 0x2a, 0x9d, 0xc4, 0xa2, 0x87, - 0xf5, 0x56, 0x68, 0x19, 0xa4, 0x74, 0xdf, 0x87, 0xf4, 0x84, 0x56, 0xb1, 0x9e, 0xd0, 0xc6, 0xb4, - 0x27, 0xf4, 0xbf, 0x60, 0x08, 0x58, 0x4f, 0x38, 0x53, 0x6e, 0x4f, 0x68, 0xd3, 0xaa, 0xa1, 0xde, - 0x83, 0x22, 0x9d, 0x21, 0x34, 0x03, 0xe5, 0x23, 0xdb, 0xc0, 0x75, 0xd3, 0xc6, 0x86, 0x74, 0x0d, - 0x95, 0xa1, 0xf4, 0x61, 0xd7, 0x66, 0x7e, 0x09, 0xc0, 0x04, 0x9f, 0x4a, 0x69, 0x4c, 0xfd, 0x97, - 0x32, 0x48, 0x87, 0x4e, 0xc7, 0xa5, 0x7b, 0xc6, 0xf6, 0xae, 0x38, 0x7e, 0x76, 0x12, 0xf8, 0x79, - 0x2d, 0xb1, 0x06, 0xa9, 0x31, 0x7e, 0x37, 0x51, 0x64, 0xc1, 0x9c, 0x17, 0x75, 0xf4, 0x58, 0x04, - 0xd4, 0x6a, 0xf6, 0x60, 0x18, 0xb4, 0x6e, 0xf7, 0x7d, 0x45, 0x1d, 0x84, 0x56, 0x82, 0x89, 0x76, - 0x74, 0xd6, 0x4b, 0x90, 0xd0, 0x09, 0xa0, 0x94, 0x36, 0x01, 0x79, 0x6f, 0xf4, 0x7c, 0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xbd, 0xb0, - 0xbc, 0xfa, 0x16, 0xcc, 0x26, 0x2b, 0x91, 0x04, 0xe3, 0xa7, 0xf8, 0x9c, 0xbb, 0xba, 0x1a, 0xfd, - 0x8c, 0x2f, 0x9d, 0xd4, 0x91, 0x9d, 0x09, 0x2e, 0x9d, 0x0f, 0xc7, 0xde, 0x2c, 0xec, 0x6d, 0xbf, - 0xe8, 0xad, 0x15, 0xbe, 0xea, 0xad, 0x15, 0xfe, 0xab, 0xb7, 0x56, 0xf8, 0xf9, 0xd7, 0x6b, 0xd7, - 0xbe, 0xfa, 0x7a, 0xed, 0xda, 0xaf, 0xbf, 0x5e, 0xbb, 0xf6, 0x89, 0x1c, 0x76, 0xc1, 0xd2, 0x6d, - 0x63, 0xb3, 0xe1, 0x6c, 0xb6, 0x4f, 0x1b, 0x9b, 0xed, 0xae, 0x71, 0x72, 0x32, 0xc1, 0x5c, 0xd7, - 0x37, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x06, 0x71, 0xb3, 0x40, 0x4c, 0x3d, 0x00, 0x00, + // 3609 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x3b, 0x5d, 0x6f, 0x1c, 0x47, + 0x72, 0x5a, 0x72, 0x97, 0xe4, 0xd6, 0xf2, 0x63, 0xd8, 0xfc, 0x1a, 0x51, 0x12, 0x87, 0x9e, 0xbb, + 0xc8, 0x72, 0x24, 0x91, 0x14, 0x7d, 0x0c, 0x1c, 0xc9, 0x30, 0x40, 0x8a, 0xfe, 0xd8, 0xb3, 0xee, + 0xac, 0x0c, 0x49, 0x19, 0xfe, 0x08, 0x98, 0xe1, 0x4e, 0xef, 0xee, 0x1c, 0x67, 0x67, 0x56, 0x33, + 0x3d, 0x5c, 0x13, 0x79, 0x49, 0x82, 0x3c, 0x04, 0x79, 0xc9, 0x01, 0x41, 0x5e, 0xf3, 0x0b, 0x92, + 0xa7, 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 0x82, 0x5b, 0x6d, 0xe2, 0xc9, + 0xbf, 0xe2, 0x0c, 0x52, 0x0b, 0xff, 0x31, 0x47, 0xda, 0xe5, 0x38, 0x23, 0x78, 0x2c, 0x50, 0x9a, + 0x69, 0x6c, 0x0f, 0x3d, 0x87, 0xeb, 0x2e, 0xae, 0x61, 0xf3, 0x0c, 0x1b, 0x83, 0xec, 0xfe, 0xed, + 0x55, 0xd8, 0xad, 0x44, 0x74, 0xfb, 0x59, 0xfe, 0x38, 0x7a, 0x80, 0x7f, 0xcd, 0xc9, 0x5f, 0x17, + 0xc9, 0x57, 0xed, 0x33, 0x6c, 0x13, 0xc7, 0x3d, 0xaf, 0x12, 0xdc, 0x1a, 0x41, 0x9d, 0x93, 0x40, + 0x0e, 0x2c, 0x09, 0x0e, 0xb8, 0x6e, 0x99, 0x06, 0x8f, 0xea, 0xc8, 0xff, 0xce, 0x69, 0x2b, 0xd9, + 0xae, 0x7f, 0x8c, 0x38, 0x82, 0x43, 0xe2, 0xd9, 0x27, 0xe8, 0xde, 0x25, 0x2d, 0xd9, 0x6f, 0xca, + 0x50, 0xa4, 0xa7, 0xed, 0xca, 0x5a, 0xaf, 0x55, 0x98, 0xa2, 0x66, 0x40, 0xf0, 0x64, 0xe2, 0x36, + 0x5a, 0x84, 0x12, 0x6e, 0xe9, 0xa6, 0x15, 0xfa, 0x32, 0xbc, 0x81, 0xb6, 0x61, 0xba, 0xe1, 0xea, + 0x67, 0x3a, 0xd1, 0x5d, 0xf6, 0xec, 0x67, 0x21, 0xa5, 0xbd, 0x39, 0xfa, 0x5e, 0x7e, 0x3f, 0x84, + 0xd3, 0x87, 0x7f, 0x25, 0x42, 0xa2, 0x4f, 0xff, 0x4d, 0xa8, 0x74, 0xf0, 0x89, 0x67, 0x12, 0x1e, + 0x29, 0x68, 0xb0, 0x21, 0xb3, 0xdd, 0x40, 0x81, 0x8f, 0x39, 0x98, 0x8e, 0x80, 0x10, 0x85, 0x0e, + 0x48, 0x22, 0x53,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 0xc5, 0x00, 0x47, 0xae, 0x85, 0x24, 0x18, 0x6f, 0x79, 0x8d, + 0xf0, 0x66, 0xa7, 0x9f, 0x08, 0x41, 0x51, 0x77, 0x1b, 0x1e, 0x4f, 0x66, 0x68, 0xec, 0xfb, 0xbb, + 0x93, 0xd4, 0x55, 0xff, 0xb1, 0x08, 0x13, 0x3c, 0x5e, 0x72, 0x65, 0x37, 0xea, 0x2e, 0x14, 0x9b, + 0xba, 0xd7, 0xe4, 0x71, 0xb0, 0xbd, 0x95, 0x61, 0x29, 0x1d, 0x86, 0x84, 0x16, 0xa1, 0x74, 0xa6, + 0x5b, 0x3e, 0x66, 0x1b, 0x57, 0xd2, 0x78, 0x03, 0x6d, 0xc1, 0x62, 0x4b, 0xff, 0x42, 0xc8, 0x1b, + 0x1e, 0xd7, 0x1c, 0x3f, 0x74, 0xd0, 0x4a, 0x1a, 0x6a, 0xe9, 0x5f, 0x24, 0x76, 0xeb, 0x31, 0xed, + 0xf9, 0x76, 0x83, 0x11, 0xef, 0x0d, 0x09, 0x46, 0xac, 0x67, 0x04, 0x23, 0xa6, 0x47, 0x44, 0x1f, + 0x3e, 0x49, 0x1b, 0xe6, 0x2f, 0xb3, 0x4a, 0xa9, 0xd9, 0xde, 0x5f, 0xde, 0x2a, 0xff, 0x6d, 0x11, + 0xa4, 0xfe, 0xb1, 0x57, 0xf9, 0xf9, 0x1c, 0xb9, 0xe4, 0x61, 0x3d, 0x74, 0xd8, 0x44, 0x47, 0x97, + 0x7b, 0x3e, 0x67, 0x97, 0xd5, 0x7d, 0xab, 0xef, 0xe5, 0x0f, 0x61, 0x82, 0x47, 0x33, 0x23, 0x5f, + 0x22, 0x2b, 0x14, 0x9a, 0x2d, 0x17, 0xef, 0x64, 0x72, 0x71, 0x12, 0x54, 0x2e, 0xfe, 0xd5, 0x5f, + 0xee, 0x17, 0xa1, 0xe6, 0xca, 0xc5, 0x87, 0x57, 0x0d, 0xf5, 0xef, 0x2b, 0x50, 0x11, 0x4a, 0x1e, + 0xae, 0xac, 0x6e, 0x6c, 0x41, 0x91, 0x9c, 0xb7, 0xa3, 0xb2, 0x9d, 0x9b, 0x43, 0x2a, 0x3a, 0x36, + 0x0e, 0xcf, 0xdb, 0x58, 0x63, 0x98, 0x61, 0x29, 0x7c, 0xc3, 0x72, 0x4e, 0x74, 0x7e, 0x3f, 0xb0, + 0x52, 0xf8, 0xf7, 0x59, 0x5b, 0x54, 0xb5, 0x7a, 0x5a, 0xd5, 0x56, 0x61, 0x4a, 0x77, 0x1b, 0x3e, + 0xeb, 0xe2, 0x77, 0x45, 0xdc, 0xbe, 0x02, 0x6a, 0xf8, 0x27, 0x85, 0x54, 0x05, 0x74, 0x6c, 0x13, + 0x22, 0xad, 0xcc, 0xf5, 0x06, 0xef, 0xf6, 0x02, 0xe5, 0xf5, 0x11, 0xd5, 0xd7, 0x31, 0x26, 0x9d, + 0xc0, 0x42, 0x46, 0x49, 0x06, 0x7a, 0x2e, 0x46, 0x38, 0x05, 0x53, 0x9e, 0xa8, 0xf2, 0x5b, 0xdd, + 0x40, 0x59, 0xca, 0x24, 0x99, 0x37, 0xd1, 0xa5, 0x0c, 0x86, 0x55, 0x43, 0x7d, 0x51, 0x82, 0x22, + 0xdd, 0xf9, 0xfe, 0x2a, 0x90, 0x79, 0x98, 0xd9, 0xf3, 0xcf, 0x1f, 0xc4, 0xac, 0xa4, 0x02, 0x42, + 0x30, 0xbb, 0xe7, 0x9f, 0xef, 0xc4, 0x20, 0x4f, 0x1a, 0x43, 0x0b, 0x30, 0x47, 0xd1, 0xb6, 0x04, + 0xe0, 0x78, 0x08, 0xdc, 0x16, 0x81, 0xc5, 0x10, 0xb8, 0x23, 0x02, 0x4b, 0x68, 0x19, 0x50, 0x28, + 0x0d, 0x16, 0x58, 0x01, 0x5a, 0x81, 0x85, 0x08, 0x2e, 0xf2, 0xab, 0x20, 0x19, 0x16, 0xe3, 0x01, + 0x22, 0xa9, 0x69, 0xb1, 0x27, 0xc5, 0x79, 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 0x77, 0xad, 0xf0, 0x75, 0x77, 0xad, + 0xf0, 0x5f, 0xdd, 0xb5, 0xc2, 0xcf, 0xbf, 0x59, 0xbb, 0xf6, 0xf5, 0x37, 0x6b, 0xd7, 0x7e, 0xfd, + 0xcd, 0xda, 0xb5, 0x4f, 0xe5, 0x48, 0x04, 0x4b, 0xb7, 0x8d, 0xcd, 0x86, 0xb3, 0xd9, 0x3e, 0x6d, + 0x6c, 0xb6, 0x3b, 0xc6, 0xc9, 0xc9, 0x04, 0x73, 0x5d, 0xdf, 0xfc, 0xdf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xeb, 0xb9, 0x30, 0x79, 0xa1, 0x3d, 0x00, 0x00, } func (m *Challenge) Marshal() (dAtA []byte, err error) { @@ -3394,12 +3405,10 @@ func (m *Challenge) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -3477,14 +3486,12 @@ func (m *ChallengeVersion) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xd2 } } - if len(m.ChallengeID) > 0 { - i -= len(m.ChallengeID) - copy(dAtA[i:], m.ChallengeID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ChallengeID))) + if m.ChallengeID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ChallengeID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Challenge != nil { { @@ -3578,12 +3585,10 @@ func (m *ChallengeVersion) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -3624,14 +3629,12 @@ func (m *ChallengeFlavor) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xd2 } } - if len(m.ChallengeVersionID) > 0 { - i -= len(m.ChallengeVersionID) - copy(dAtA[i:], m.ChallengeVersionID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ChallengeVersionID))) + if m.ChallengeVersionID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ChallengeVersionID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.ChallengeVersion != nil { { @@ -3667,12 +3670,10 @@ func (m *ChallengeFlavor) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -3697,14 +3698,12 @@ func (m *ChallengeInstance) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.FlavorID) > 0 { - i -= len(m.FlavorID) - copy(dAtA[i:], m.FlavorID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.FlavorID))) + if m.FlavorID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.FlavorID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.Flavor != nil { { @@ -3720,14 +3719,12 @@ func (m *ChallengeInstance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.HypervisorID) > 0 { - i -= len(m.HypervisorID) - copy(dAtA[i:], m.HypervisorID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.HypervisorID))) + if m.HypervisorID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.HypervisorID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Hypervisor != nil { { @@ -3770,12 +3767,10 @@ func (m *ChallengeInstance) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -3861,12 +3856,10 @@ func (m *Hypervisor) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -3891,14 +3884,12 @@ func (m *TeamMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.TeamID) > 0 { - i -= len(m.TeamID) - copy(dAtA[i:], m.TeamID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TeamID))) + if m.TeamID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TeamID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.Team != nil { { @@ -3914,14 +3905,12 @@ func (m *TeamMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.UserID) > 0 { - i -= len(m.UserID) - copy(dAtA[i:], m.UserID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.UserID))) + if m.UserID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.UserID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.User != nil { { @@ -3964,12 +3953,10 @@ func (m *TeamMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -4090,14 +4077,12 @@ func (m *TournamentMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xe2 } } - if len(m.TournamentTeamID) > 0 { - i -= len(m.TournamentTeamID) - copy(dAtA[i:], m.TournamentTeamID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TournamentTeamID))) + if m.TournamentTeamID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TournamentTeamID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.TournamentTeam != nil { { @@ -4113,14 +4098,12 @@ func (m *TournamentMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.UserID) > 0 { - i -= len(m.UserID) - copy(dAtA[i:], m.UserID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.UserID))) + if m.UserID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.UserID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.User != nil { { @@ -4163,12 +4146,10 @@ func (m *TournamentMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -4193,14 +4174,12 @@ func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ActiveTournamentID) > 0 { - i -= len(m.ActiveTournamentID) - copy(dAtA[i:], m.ActiveTournamentID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ActiveTournamentID))) + if m.ActiveTournamentID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ActiveTournamentID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xf2 + dAtA[i] = 0xf0 } if m.ActiveTournament != nil { { @@ -4216,14 +4195,12 @@ func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xea } - if len(m.ActiveTournamentMemberID) > 0 { - i -= len(m.ActiveTournamentMemberID) - copy(dAtA[i:], m.ActiveTournamentMemberID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ActiveTournamentMemberID))) + if m.ActiveTournamentMemberID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ActiveTournamentMemberID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xe2 + dAtA[i] = 0xe0 } if m.ActiveTournamentMember != nil { { @@ -4287,6 +4264,15 @@ func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xc2 } } + if len(m.OAuthSubject) > 0 { + i -= len(m.OAuthSubject) + copy(dAtA[i:], m.OAuthSubject) + i = encodeVarintPwdb(dAtA, i, uint64(len(m.OAuthSubject))) + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0xca + } if len(m.Locale) > 0 { i -= len(m.Locale) copy(dAtA[i:], m.Locale) @@ -4352,12 +4338,10 @@ func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -4514,12 +4498,10 @@ func (m *Team) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -4668,12 +4650,10 @@ func (m *Tournament) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -4767,14 +4747,12 @@ func (m *TournamentTeam) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xea } } - if len(m.TeamID) > 0 { - i -= len(m.TeamID) - copy(dAtA[i:], m.TeamID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TeamID))) + if m.TeamID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TeamID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.Team != nil { { @@ -4790,14 +4768,12 @@ func (m *TournamentTeam) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.TournamentID) > 0 { - i -= len(m.TournamentID) - copy(dAtA[i:], m.TournamentID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TournamentID))) + if m.TournamentID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TournamentID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Tournament != nil { { @@ -4845,12 +4821,10 @@ func (m *TournamentTeam) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -4912,14 +4886,12 @@ func (m *WhoswhoAttempt) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.TargetTeamID) > 0 { - i -= len(m.TargetTeamID) - copy(dAtA[i:], m.TargetTeamID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TargetTeamID))) + if m.TargetTeamID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TargetTeamID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xea + dAtA[i] = 0xe8 } if m.TargetTeam != nil { { @@ -4935,14 +4907,12 @@ func (m *WhoswhoAttempt) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xe2 } - if len(m.TargetMemberID) > 0 { - i -= len(m.TargetMemberID) - copy(dAtA[i:], m.TargetMemberID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TargetMemberID))) + if m.TargetMemberID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TargetMemberID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.TargetMember != nil { { @@ -4958,14 +4928,12 @@ func (m *WhoswhoAttempt) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.AuthorID) > 0 { - i -= len(m.AuthorID) - copy(dAtA[i:], m.AuthorID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.AuthorID))) + if m.AuthorID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.AuthorID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Author != nil { { @@ -5013,12 +4981,10 @@ func (m *WhoswhoAttempt) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5043,14 +5009,12 @@ func (m *ChallengeValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.TournamentMemberID) > 0 { - i -= len(m.TournamentMemberID) - copy(dAtA[i:], m.TournamentMemberID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TournamentMemberID))) + if m.TournamentMemberID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TournamentMemberID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.TournamentMember != nil { { @@ -5066,14 +5030,12 @@ func (m *ChallengeValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.ChallengeSubscriptionID) > 0 { - i -= len(m.ChallengeSubscriptionID) - copy(dAtA[i:], m.ChallengeSubscriptionID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ChallengeSubscriptionID))) + if m.ChallengeSubscriptionID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ChallengeSubscriptionID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.ChallengeSubscription != nil { { @@ -5134,12 +5096,10 @@ func (m *ChallengeValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5180,14 +5140,12 @@ func (m *ChallengeSubscription) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xe2 } } - if len(m.ChallengeFlavorID) > 0 { - i -= len(m.ChallengeFlavorID) - copy(dAtA[i:], m.ChallengeFlavorID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ChallengeFlavorID))) + if m.ChallengeFlavorID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ChallengeFlavorID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.ChallengeFlavor != nil { { @@ -5203,14 +5161,12 @@ func (m *ChallengeSubscription) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.TournamentTeamID) > 0 { - i -= len(m.TournamentTeamID) - copy(dAtA[i:], m.TournamentTeamID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TournamentTeamID))) + if m.TournamentTeamID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TournamentTeamID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.TournamentTeam != nil { { @@ -5246,12 +5202,10 @@ func (m *ChallengeSubscription) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5276,14 +5230,12 @@ func (m *InventoryItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.OwnerID) > 0 { - i -= len(m.OwnerID) - copy(dAtA[i:], m.OwnerID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.OwnerID))) + if m.OwnerID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.OwnerID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Owner != nil { { @@ -5326,12 +5278,10 @@ func (m *InventoryItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5356,14 +5306,12 @@ func (m *Notification) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.UserID) > 0 { - i -= len(m.UserID) - copy(dAtA[i:], m.UserID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.UserID))) + if m.UserID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.UserID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.User != nil { { @@ -5438,12 +5386,10 @@ func (m *Notification) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5484,14 +5430,12 @@ func (m *Coupon) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xd2 } } - if len(m.TournamentID) > 0 { - i -= len(m.TournamentID) - copy(dAtA[i:], m.TournamentID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.TournamentID))) + if m.TournamentID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.TournamentID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Tournament != nil { { @@ -5550,12 +5494,10 @@ func (m *Coupon) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5580,14 +5522,12 @@ func (m *CouponValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.CouponID) > 0 { - i -= len(m.CouponID) - copy(dAtA[i:], m.CouponID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.CouponID))) + if m.CouponID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.CouponID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.Coupon != nil { { @@ -5603,14 +5543,12 @@ func (m *CouponValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.AuthorID) > 0 { - i -= len(m.AuthorID) - copy(dAtA[i:], m.AuthorID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.AuthorID))) + if m.AuthorID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.AuthorID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Author != nil { { @@ -5655,12 +5593,10 @@ func (m *CouponValidation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -5685,14 +5621,12 @@ func (m *Achievement) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ChallengeValidationID) > 0 { - i -= len(m.ChallengeValidationID) - copy(dAtA[i:], m.ChallengeValidationID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ChallengeValidationID))) + if m.ChallengeValidationID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ChallengeValidationID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xda + dAtA[i] = 0xd8 } if m.ChallengeValidation != nil { { @@ -5708,14 +5642,12 @@ func (m *Achievement) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0xd2 } - if len(m.AuthorID) > 0 { - i -= len(m.AuthorID) - copy(dAtA[i:], m.AuthorID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.AuthorID))) + if m.AuthorID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.AuthorID)) i-- dAtA[i] = 0xc i-- - dAtA[i] = 0xca + dAtA[i] = 0xc8 } if m.Author != nil { { @@ -5788,12 +5720,10 @@ func (m *Achievement) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintPwdb(dAtA, i, uint64(len(m.ID))) + if m.ID != 0 { + i = encodeVarintPwdb(dAtA, i, uint64(m.ID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -6154,9 +6084,8 @@ func (m *Challenge) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6223,9 +6152,8 @@ func (m *ChallengeVersion) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6260,9 +6188,8 @@ func (m *ChallengeVersion) Size() (n int) { l = m.Challenge.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ChallengeID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ChallengeID != 0 { + n += 2 + sovPwdb(uint64(m.ChallengeID)) } if len(m.Flavors) > 0 { for _, e := range m.Flavors { @@ -6279,9 +6206,8 @@ func (m *ChallengeFlavor) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6295,9 +6221,8 @@ func (m *ChallengeFlavor) Size() (n int) { l = m.ChallengeVersion.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ChallengeVersionID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ChallengeVersionID != 0 { + n += 2 + sovPwdb(uint64(m.ChallengeVersionID)) } if len(m.Instances) > 0 { for _, e := range m.Instances { @@ -6314,9 +6239,8 @@ func (m *ChallengeInstance) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6333,17 +6257,15 @@ func (m *ChallengeInstance) Size() (n int) { l = m.Hypervisor.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.HypervisorID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.HypervisorID != 0 { + n += 2 + sovPwdb(uint64(m.HypervisorID)) } if m.Flavor != nil { l = m.Flavor.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.FlavorID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.FlavorID != 0 { + n += 2 + sovPwdb(uint64(m.FlavorID)) } return n } @@ -6354,9 +6276,8 @@ func (m *Hypervisor) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6392,9 +6313,8 @@ func (m *TeamMember) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6411,17 +6331,15 @@ func (m *TeamMember) Size() (n int) { l = m.User.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.UserID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.UserID != 0 { + n += 2 + sovPwdb(uint64(m.UserID)) } if m.Team != nil { l = m.Team.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TeamID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TeamID != 0 { + n += 2 + sovPwdb(uint64(m.TeamID)) } return n } @@ -6432,9 +6350,8 @@ func (m *TournamentMember) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6451,17 +6368,15 @@ func (m *TournamentMember) Size() (n int) { l = m.User.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.UserID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.UserID != 0 { + n += 2 + sovPwdb(uint64(m.UserID)) } if m.TournamentTeam != nil { l = m.TournamentTeam.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TournamentTeamID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TournamentTeamID != 0 { + n += 2 + sovPwdb(uint64(m.TournamentTeamID)) } if len(m.Coupons) > 0 { for _, e := range m.Coupons { @@ -6508,9 +6423,8 @@ func (m *User) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6540,6 +6454,10 @@ func (m *User) Size() (n int) { if l > 0 { n += 2 + l + sovPwdb(uint64(l)) } + l = len(m.OAuthSubject) + if l > 0 { + n += 2 + l + sovPwdb(uint64(l)) + } if len(m.TournamentMemberships) > 0 { for _, e := range m.TournamentMemberships { l = e.Size() @@ -6562,17 +6480,15 @@ func (m *User) Size() (n int) { l = m.ActiveTournamentMember.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ActiveTournamentMemberID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ActiveTournamentMemberID != 0 { + n += 2 + sovPwdb(uint64(m.ActiveTournamentMemberID)) } if m.ActiveTournament != nil { l = m.ActiveTournament.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ActiveTournamentID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ActiveTournamentID != 0 { + n += 2 + sovPwdb(uint64(m.ActiveTournamentID)) } return n } @@ -6598,9 +6514,8 @@ func (m *Team) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6664,9 +6579,8 @@ func (m *Tournament) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6725,9 +6639,8 @@ func (m *TournamentTeam) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6744,17 +6657,15 @@ func (m *TournamentTeam) Size() (n int) { l = m.Tournament.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TournamentID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TournamentID != 0 { + n += 2 + sovPwdb(uint64(m.TournamentID)) } if m.Team != nil { l = m.Team.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TeamID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TeamID != 0 { + n += 2 + sovPwdb(uint64(m.TeamID)) } if len(m.ChallengeSubscriptions) > 0 { for _, e := range m.ChallengeSubscriptions { @@ -6792,9 +6703,8 @@ func (m *WhoswhoAttempt) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6811,25 +6721,22 @@ func (m *WhoswhoAttempt) Size() (n int) { l = m.Author.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.AuthorID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.AuthorID != 0 { + n += 2 + sovPwdb(uint64(m.AuthorID)) } if m.TargetMember != nil { l = m.TargetMember.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TargetMemberID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TargetMemberID != 0 { + n += 2 + sovPwdb(uint64(m.TargetMemberID)) } if m.TargetTeam != nil { l = m.TargetTeam.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TargetTeamID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TargetTeamID != 0 { + n += 2 + sovPwdb(uint64(m.TargetTeamID)) } return n } @@ -6840,9 +6747,8 @@ func (m *ChallengeValidation) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6867,17 +6773,15 @@ func (m *ChallengeValidation) Size() (n int) { l = m.ChallengeSubscription.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ChallengeSubscriptionID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ChallengeSubscriptionID != 0 { + n += 2 + sovPwdb(uint64(m.ChallengeSubscriptionID)) } if m.TournamentMember != nil { l = m.TournamentMember.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TournamentMemberID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TournamentMemberID != 0 { + n += 2 + sovPwdb(uint64(m.TournamentMemberID)) } return n } @@ -6888,9 +6792,8 @@ func (m *ChallengeSubscription) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6904,17 +6807,15 @@ func (m *ChallengeSubscription) Size() (n int) { l = m.TournamentTeam.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TournamentTeamID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TournamentTeamID != 0 { + n += 2 + sovPwdb(uint64(m.TournamentTeamID)) } if m.ChallengeFlavor != nil { l = m.ChallengeFlavor.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ChallengeFlavorID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ChallengeFlavorID != 0 { + n += 2 + sovPwdb(uint64(m.ChallengeFlavorID)) } if len(m.Validations) > 0 { for _, e := range m.Validations { @@ -6931,9 +6832,8 @@ func (m *InventoryItem) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6950,9 +6850,8 @@ func (m *InventoryItem) Size() (n int) { l = m.Owner.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.OwnerID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.OwnerID != 0 { + n += 2 + sovPwdb(uint64(m.OwnerID)) } return n } @@ -6963,9 +6862,8 @@ func (m *Notification) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -6994,9 +6892,8 @@ func (m *Notification) Size() (n int) { l = m.User.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.UserID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.UserID != 0 { + n += 2 + sovPwdb(uint64(m.UserID)) } return n } @@ -7007,9 +6904,8 @@ func (m *Coupon) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -7033,9 +6929,8 @@ func (m *Coupon) Size() (n int) { l = m.Tournament.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.TournamentID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.TournamentID != 0 { + n += 2 + sovPwdb(uint64(m.TournamentID)) } if len(m.Validations) > 0 { for _, e := range m.Validations { @@ -7052,9 +6947,8 @@ func (m *CouponValidation) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -7072,17 +6966,15 @@ func (m *CouponValidation) Size() (n int) { l = m.Author.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.AuthorID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.AuthorID != 0 { + n += 2 + sovPwdb(uint64(m.AuthorID)) } if m.Coupon != nil { l = m.Coupon.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.CouponID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.CouponID != 0 { + n += 2 + sovPwdb(uint64(m.CouponID)) } return n } @@ -7093,9 +6985,8 @@ func (m *Achievement) Size() (n int) { } var l int _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovPwdb(uint64(l)) + if m.ID != 0 { + n += 1 + sovPwdb(uint64(m.ID)) } if m.CreatedAt != nil { l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.CreatedAt) @@ -7123,17 +7014,15 @@ func (m *Achievement) Size() (n int) { l = m.Author.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.AuthorID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.AuthorID != 0 { + n += 2 + sovPwdb(uint64(m.AuthorID)) } if m.ChallengeValidation != nil { l = m.ChallengeValidation.Size() n += 2 + l + sovPwdb(uint64(l)) } - l = len(m.ChallengeValidationID) - if l > 0 { - n += 2 + l + sovPwdb(uint64(l)) + if m.ChallengeValidationID != 0 { + n += 2 + sovPwdb(uint64(m.ChallengeValidationID)) } return n } @@ -7314,10 +7203,10 @@ func (m *Challenge) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -7327,24 +7216,11 @@ func (m *Challenge) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -7804,10 +7680,10 @@ func (m *ChallengeVersion) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -7817,24 +7693,11 @@ func (m *ChallengeVersion) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -8099,10 +7962,10 @@ func (m *ChallengeVersion) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeID", wireType) } - var stringLen uint64 + m.ChallengeID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8112,24 +7975,11 @@ func (m *ChallengeVersion) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChallengeID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChallengeID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Flavors", wireType) @@ -8218,10 +8068,10 @@ func (m *ChallengeFlavor) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8231,24 +8081,11 @@ func (m *ChallengeFlavor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -8351,17 +8188,17 @@ func (m *ChallengeFlavor) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ChallengeVersion == nil { - m.ChallengeVersion = &Challenge{} + m.ChallengeVersion = &ChallengeVersion{} } if err := m.ChallengeVersion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeVersionID", wireType) } - var stringLen uint64 + m.ChallengeVersionID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8371,24 +8208,11 @@ func (m *ChallengeFlavor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChallengeVersionID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChallengeVersionID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Instances", wireType) @@ -8477,10 +8301,10 @@ func (m *ChallengeInstance) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8490,24 +8314,11 @@ func (m *ChallengeInstance) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -8636,10 +8447,10 @@ func (m *ChallengeInstance) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field HypervisorID", wireType) } - var stringLen uint64 + m.HypervisorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8649,24 +8460,11 @@ func (m *ChallengeInstance) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.HypervisorID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HypervisorID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Flavor", wireType) @@ -8704,10 +8502,10 @@ func (m *ChallengeInstance) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FlavorID", wireType) } - var stringLen uint64 + m.FlavorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8717,24 +8515,11 @@ func (m *ChallengeInstance) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.FlavorID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FlavorID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -8789,10 +8574,10 @@ func (m *Hypervisor) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -8802,24 +8587,11 @@ func (m *Hypervisor) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -9063,10 +8835,10 @@ func (m *TeamMember) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9076,24 +8848,11 @@ func (m *TeamMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -9222,10 +8981,10 @@ func (m *TeamMember) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UserID", wireType) } - var stringLen uint64 + m.UserID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9235,24 +8994,11 @@ func (m *TeamMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.UserID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UserID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Team", wireType) @@ -9290,10 +9036,10 @@ func (m *TeamMember) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TeamID", wireType) } - var stringLen uint64 + m.TeamID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9303,24 +9049,11 @@ func (m *TeamMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TeamID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TeamID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -9375,10 +9108,10 @@ func (m *TournamentMember) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9388,24 +9121,11 @@ func (m *TournamentMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -9534,10 +9254,10 @@ func (m *TournamentMember) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UserID", wireType) } - var stringLen uint64 + m.UserID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9547,24 +9267,11 @@ func (m *TournamentMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.UserID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UserID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentTeam", wireType) @@ -9602,10 +9309,10 @@ func (m *TournamentMember) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentTeamID", wireType) } - var stringLen uint64 + m.TournamentTeamID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9615,24 +9322,11 @@ func (m *TournamentMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TournamentTeamID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TournamentTeamID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 204: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Coupons", wireType) @@ -9891,10 +9585,10 @@ func (m *User) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -9904,24 +9598,11 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -10154,11 +9835,11 @@ func (m *User) Unmarshal(dAtA []byte) error { } m.Locale = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 200: + case 105: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TournamentMemberships", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OAuthSubject", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -10168,29 +9849,27 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthPwdb } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthPwdb } if postIndex > l { return io.ErrUnexpectedEOF } - m.TournamentMemberships = append(m.TournamentMemberships, &TournamentMember{}) - if err := m.TournamentMemberships[len(m.TournamentMemberships)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.OAuthSubject = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 201: + case 200: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Notifications", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TournamentMemberships", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -10217,8 +9896,42 @@ func (m *User) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Notifications = append(m.Notifications, &Notification{}) - if err := m.Notifications[len(m.Notifications)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.TournamentMemberships = append(m.TournamentMemberships, &TournamentMember{}) + if err := m.TournamentMemberships[len(m.TournamentMemberships)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 201: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Notifications", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPwdb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPwdb + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPwdb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Notifications = append(m.Notifications, &Notification{}) + if err := m.Notifications[len(m.Notifications)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -10293,10 +10006,10 @@ func (m *User) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 204: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ActiveTournamentMemberID", wireType) } - var stringLen uint64 + m.ActiveTournamentMemberID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -10306,24 +10019,11 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ActiveTournamentMemberID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ActiveTournamentMemberID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 205: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ActiveTournament", wireType) @@ -10361,10 +10061,10 @@ func (m *User) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 206: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ActiveTournamentID", wireType) } - var stringLen uint64 + m.ActiveTournamentID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -10374,24 +10074,11 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ActiveTournamentID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ActiveTournamentID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -10533,10 +10220,10 @@ func (m *Team) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -10546,24 +10233,11 @@ func (m *Team) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -10975,10 +10649,10 @@ func (m *Tournament) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -10988,24 +10662,11 @@ func (m *Tournament) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -11377,10 +11038,10 @@ func (m *TournamentTeam) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -11390,24 +11051,11 @@ func (m *TournamentTeam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -11537,10 +11185,10 @@ func (m *TournamentTeam) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentID", wireType) } - var stringLen uint64 + m.TournamentID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -11550,24 +11198,11 @@ func (m *TournamentTeam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TournamentID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TournamentID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Team", wireType) @@ -11605,10 +11240,10 @@ func (m *TournamentTeam) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TeamID", wireType) } - var stringLen uint64 + m.TeamID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -11618,24 +11253,11 @@ func (m *TournamentTeam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TeamID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TeamID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 205: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeSubscriptions", wireType) @@ -11845,10 +11467,10 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -11858,24 +11480,11 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -12005,10 +11614,10 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AuthorID", wireType) } - var stringLen uint64 + m.AuthorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12018,24 +11627,11 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.AuthorID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuthorID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TargetMember", wireType) @@ -12073,10 +11669,10 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TargetMemberID", wireType) } - var stringLen uint64 + m.TargetMemberID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12086,24 +11682,11 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TargetMemberID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetMemberID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 204: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TargetTeam", wireType) @@ -12141,10 +11724,10 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 205: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TargetTeamID", wireType) } - var stringLen uint64 + m.TargetTeamID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12154,24 +11737,11 @@ func (m *WhoswhoAttempt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TargetTeamID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetTeamID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -12226,10 +11796,10 @@ func (m *ChallengeValidation) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12239,24 +11809,11 @@ func (m *ChallengeValidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -12449,10 +12006,10 @@ func (m *ChallengeValidation) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeSubscriptionID", wireType) } - var stringLen uint64 + m.ChallengeSubscriptionID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12462,24 +12019,11 @@ func (m *ChallengeValidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChallengeSubscriptionID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChallengeSubscriptionID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentMember", wireType) @@ -12517,10 +12061,10 @@ func (m *ChallengeValidation) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentMemberID", wireType) } - var stringLen uint64 + m.TournamentMemberID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12530,24 +12074,11 @@ func (m *ChallengeValidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TournamentMemberID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TournamentMemberID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -12602,10 +12133,10 @@ func (m *ChallengeSubscription) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12615,24 +12146,11 @@ func (m *ChallengeSubscription) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -12742,10 +12260,10 @@ func (m *ChallengeSubscription) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentTeamID", wireType) } - var stringLen uint64 + m.TournamentTeamID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12755,24 +12273,11 @@ func (m *ChallengeSubscription) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TournamentTeamID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TournamentTeamID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeFlavor", wireType) @@ -12810,10 +12315,10 @@ func (m *ChallengeSubscription) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeFlavorID", wireType) } - var stringLen uint64 + m.ChallengeFlavorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12823,24 +12328,11 @@ func (m *ChallengeSubscription) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChallengeFlavorID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChallengeFlavorID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 204: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Validations", wireType) @@ -12929,10 +12421,10 @@ func (m *InventoryItem) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -12942,24 +12434,11 @@ func (m *InventoryItem) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -13088,10 +12567,10 @@ func (m *InventoryItem) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) } - var stringLen uint64 + m.OwnerID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -13101,24 +12580,11 @@ func (m *InventoryItem) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.OwnerID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OwnerID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -13173,10 +12639,10 @@ func (m *Notification) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -13186,24 +12652,11 @@ func (m *Notification) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -13429,10 +12882,10 @@ func (m *Notification) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UserID", wireType) } - var stringLen uint64 + m.UserID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -13442,24 +12895,11 @@ func (m *Notification) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.UserID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UserID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -13514,10 +12954,10 @@ func (m *Coupon) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -13527,24 +12967,11 @@ func (m *Coupon) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -13724,10 +13151,10 @@ func (m *Coupon) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentID", wireType) } - var stringLen uint64 + m.TournamentID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -13737,24 +13164,11 @@ func (m *Coupon) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TournamentID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TournamentID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Validations", wireType) @@ -13843,10 +13257,10 @@ func (m *CouponValidation) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -13856,24 +13270,11 @@ func (m *CouponValidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -14015,10 +13416,10 @@ func (m *CouponValidation) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AuthorID", wireType) } - var stringLen uint64 + m.AuthorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -14028,24 +13429,11 @@ func (m *CouponValidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.AuthorID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuthorID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Coupon", wireType) @@ -14083,10 +13471,10 @@ func (m *CouponValidation) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CouponID", wireType) } - var stringLen uint64 + m.CouponID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -14096,24 +13484,11 @@ func (m *CouponValidation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.CouponID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CouponID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) @@ -14168,10 +13543,10 @@ func (m *Achievement) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } - var stringLen uint64 + m.ID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -14181,24 +13556,11 @@ func (m *Achievement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) @@ -14411,10 +13773,10 @@ func (m *Achievement) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 201: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AuthorID", wireType) } - var stringLen uint64 + m.AuthorID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -14424,24 +13786,11 @@ func (m *Achievement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.AuthorID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuthorID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 202: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeValidation", wireType) @@ -14479,10 +13828,10 @@ func (m *Achievement) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 203: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChallengeValidationID", wireType) } - var stringLen uint64 + m.ChallengeValidationID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwdb @@ -14492,24 +13841,11 @@ func (m *Achievement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChallengeValidationID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwdb - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwdb - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChallengeValidationID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwdb(dAtA[iNdEx:]) diff --git a/go/pkg/pwdb/testing.go b/go/pkg/pwdb/testing.go index c7407099c..57d42d2ff 100644 --- a/go/pkg/pwdb/testing.go +++ b/go/pkg/pwdb/testing.go @@ -3,6 +3,7 @@ package pwdb import ( "testing" + "github.com/bwmarrin/snowflake" "github.com/jinzhu/gorm" "go.uber.org/zap" ) @@ -12,16 +13,22 @@ func TestingSqliteDB(t *testing.T, logger *zap.Logger) *gorm.DB { db, err := gorm.Open("sqlite3", ":memory:") if err != nil { - t.Fatalf("failed to initialize in-memory sqlite server: %v", err) + t.Fatalf("init in-memory sqlite server: %v", err) + } + + sfn, err := snowflake.NewNode(1) + if err != nil { + t.Fatalf("init snowflake generator: %v", err) } opts := Opts{ Logger: logger, skipFK: true, // required for sqlite :( } - db, err = Configure(db, opts) + + db, err = Configure(db, sfn, opts) if err != nil { - t.Fatalf("failed to initialize pwdb: %v", err) + t.Fatalf("init pwdb: %v", err) } return db diff --git a/go/pkg/pwengine/api_dev_generatefakedata.go b/go/pkg/pwengine/api_dev_generatefakedata.go index bf897061a..6df8a839f 100644 --- a/go/pkg/pwengine/api_dev_generatefakedata.go +++ b/go/pkg/pwengine/api_dev_generatefakedata.go @@ -7,5 +7,5 @@ import ( ) func (e *engine) GenerateFakeData(context.Context, *Void) (*Void, error) { - return &Void{}, pwdb.GenerateFakeData(e.db, e.logger.Named("generate-fake-data")) + return &Void{}, pwdb.GenerateFakeData(e.db, e.snowflake, e.logger.Named("generate-fake-data")) } diff --git a/go/pkg/pwengine/api_pub_getstatus_test.go b/go/pkg/pwengine/api_pub_getstatus_test.go index b31afa2f2..43d68b2dc 100644 --- a/go/pkg/pwengine/api_pub_getstatus_test.go +++ b/go/pkg/pwengine/api_pub_getstatus_test.go @@ -4,10 +4,12 @@ import ( "context" "reflect" "testing" + + "pathwar.land/go/internal/testutil" ) func TestEngine_GetStatus(t *testing.T) { - engine, cleanup := TestingEngine(t, Opts{}) + engine, cleanup := TestingEngine(t, Opts{Logger: testutil.Logger(t)}) defer cleanup() ctx := context.Background() diff --git a/go/pkg/pwengine/api_pub_getusersession.go b/go/pkg/pwengine/api_pub_getusersession.go index 50954b845..c359e06d6 100644 --- a/go/pkg/pwengine/api_pub_getusersession.go +++ b/go/pkg/pwengine/api_pub_getusersession.go @@ -5,8 +5,6 @@ import ( "crypto/md5" "fmt" - "github.com/jinzhu/gorm" - "github.com/pkg/errors" "go.uber.org/zap" "pathwar.land/go/pkg/pwdb" "pathwar.land/go/pkg/pwsso" @@ -15,7 +13,7 @@ import ( func (e *engine) GetUserSession(ctx context.Context, _ *Void) (*UserSessionOutput, error) { token, err := tokenFromContext(ctx) if err != nil { - return nil, errors.Wrap(err, "failed to get token from context") + return nil, fmt.Errorf("get token from context: %w", err) } zap.L().Debug("token", zap.Any("token", token)) @@ -24,19 +22,19 @@ func (e *engine) GetUserSession(ctx context.Context, _ *Void) (*UserSessionOutpu // try loading it from database output.User, err = e.loadOAuthUser(output.Claims.ActionToken.Sub) - if err != nil && !gorm.IsRecordNotFoundError(err) { + if err != nil && !pwdb.IsRecordNotFoundError(err) { // internal error - return nil, err + return nil, fmt.Errorf("load oauth user: %w", err) } // new user - if gorm.IsRecordNotFoundError(err) { + if pwdb.IsRecordNotFoundError(err) { output.IsNewUser = true if _, err = e.newUserFromClaims(output.Claims); err != nil { - return nil, err + return nil, fmt.Errorf("new user from claims: %w", err) } if output.User, err = e.loadOAuthUser(output.Claims.ActionToken.Sub); err != nil { - return nil, err + return nil, fmt.Errorf("load oauth user: %w", err) } } @@ -49,7 +47,7 @@ func (e *engine) GetUserSession(ctx context.Context, _ *Void) (*UserSessionOutpu output.Tournaments, err = e.tournaments(ctx) if err != nil { - return nil, err + return nil, fmt.Errorf("get tournaments: %w", err) } return output, nil @@ -61,30 +59,33 @@ func (e *engine) tournaments(ctx context.Context) ([]*UserSessionOutput_Tourname memberships []*pwdb.TournamentMember ) - userID, err := subjectFromContext(ctx) + userID, err := userIDFromContext(ctx, e.db) if err != nil { - return nil, err - } - - if err := e.db. - Where(pwdb.Tournament{Visibility: pwdb.Tournament_Public}). // FIXME: admin can see everything - Find(&tournaments). - Error; err != nil { - return nil, err + return nil, fmt.Errorf("get userid from context: %w", err) } - // FIXME: should be doable in a unique request with LEFT joining - if err := e.db. + // get tournament teams for user + err = e.db. Preload("TournamentTeam"). Preload("TournamentTeam.Team"). Where(pwdb.TournamentMember{UserID: userID}). Find(&memberships). - Error; err != nil && !gorm.IsRecordNotFoundError(err) { - return nil, err + Error + if err != nil && !pwdb.IsRecordNotFoundError(err) { + return nil, fmt.Errorf("fetch tournament teams: %w", err) } - output := []*UserSessionOutput_TournamentAndTeam{} + // get all available tournaments + err = e.db. + Where(pwdb.Tournament{Visibility: pwdb.Tournament_Public}). + // FIXME: admins can see everything + Find(&tournaments). + Error + if err != nil { + return nil, fmt.Errorf("fetch tournaments: %w", err) + } + output := []*UserSessionOutput_TournamentAndTeam{} for _, tournament := range tournaments { item := &UserSessionOutput_TournamentAndTeam{ Tournament: tournament, @@ -105,16 +106,19 @@ func (e *engine) tournaments(ctx context.Context) ([]*UserSessionOutput_Tourname func (e *engine) loadOAuthUser(subject string) (*pwdb.User, error) { var user pwdb.User - if err := e.db. + err := e.db. Preload("ActiveTournamentMember"). Preload("ActiveTournamentMember.TournamentTeam"). Preload("ActiveTournamentMember.TournamentTeam.Tournament"). Preload("ActiveTournamentMember.TournamentTeam.Team"). - Where(pwdb.User{ID: subject}). + Where(pwdb.User{OAuthSubject: subject}). First(&user). - Error; err != nil { - return nil, err + Error + + if err != nil { + return nil, fmt.Errorf("fetch user from subject %q: %w", subject, err) } + return &user, nil } @@ -131,10 +135,10 @@ func (e *engine) newUserFromClaims(claims *pwsso.Claims) (*pwdb.User, error) { } user := pwdb.User{ - ID: claims.ActionToken.Sub, - Username: claims.PreferredUsername, - Email: claims.Email, - GravatarURL: gravatarURL, + Username: claims.PreferredUsername, + Email: claims.Email, + GravatarURL: gravatarURL, + OAuthSubject: claims.ActionToken.Sub, // WebsiteURL // Locale diff --git a/go/pkg/pwengine/api_pub_getusersession_test.go b/go/pkg/pwengine/api_pub_getusersession_test.go index ae6ff509c..4a5c267e9 100644 --- a/go/pkg/pwengine/api_pub_getusersession_test.go +++ b/go/pkg/pwengine/api_pub_getusersession_test.go @@ -5,13 +5,14 @@ import ( "testing" "moul.io/godev" + "pathwar.land/go/internal/testutil" "pathwar.land/go/pkg/pwsso" ) func TestEngine_GetUserSession(t *testing.T) { - engine, cleanup := TestingEngine(t, Opts{}) + engine, cleanup := TestingEngine(t, Opts{Logger: testutil.Logger(t)}) defer cleanup() - ctx := testSetContextToken(t, context.Background()) + ctx := testingSetContextToken(context.Background(), t) session, err := engine.GetUserSession(ctx, nil) if err != nil { diff --git a/go/pkg/pwengine/api_pub_listtournamentteams.go b/go/pkg/pwengine/api_pub_listtournamentteams.go index 1d3ae2b70..cf795c2cf 100644 --- a/go/pkg/pwengine/api_pub_listtournamentteams.go +++ b/go/pkg/pwengine/api_pub_listtournamentteams.go @@ -9,7 +9,7 @@ import ( func (e *engine) ListTournamentTeams(ctx context.Context, in *ListTournamentTeamsInput) (*pwdb.TournamentTeamList, error) { { // validation - if in.TournamentID == "" { + if in.TournamentID == 0 { return nil, ErrMissingArgument } @@ -17,11 +17,11 @@ func (e *engine) ListTournamentTeams(ctx context.Context, in *ListTournamentTeam err := e.db. Table("tournament"). Select("id"). - Where("id = ?", in.TournamentID). + Where(&pwdb.Tournament{ID: in.TournamentID}). Count(&c). Error if err != nil { - return nil, fmt.Errorf("failed to fetch tournament: %w", err) + return nil, fmt.Errorf("fetch tournament: %w", err) } if c == 0 { return nil, ErrInvalidArgument // invalid in.TournamentID @@ -35,7 +35,7 @@ func (e *engine) ListTournamentTeams(ctx context.Context, in *ListTournamentTeam Find(&ret.Items). Error if err != nil { - return nil, fmt.Errorf("failed to fetch tournament teams from db: %w", err) + return nil, fmt.Errorf("fetch tournament teams from db: %w", err) } return &ret, nil diff --git a/go/pkg/pwengine/api_pub_listtournamentteams_test.go b/go/pkg/pwengine/api_pub_listtournamentteams_test.go index 90b16c4a6..3489eb6ca 100644 --- a/go/pkg/pwengine/api_pub_listtournamentteams_test.go +++ b/go/pkg/pwengine/api_pub_listtournamentteams_test.go @@ -4,16 +4,18 @@ import ( "context" "errors" "testing" + + "pathwar.land/go/internal/testutil" ) func TestEngine_ListTournamentTeams(t *testing.T) { - engine, cleanup := TestingEngine(t, Opts{}) + engine, cleanup := TestingEngine(t, Opts{Logger: testutil.Logger(t)}) defer cleanup() - ctx := testSetContextToken(t, context.Background()) + ctx := testingSetContextToken(context.Background(), t) // FIXME: check for permissions - tournaments := map[string]string{} + tournaments := map[string]int64{} for _, tournament := range testingTournaments(t, engine).Items { tournaments[tournament.Name] = tournament.ID } @@ -32,7 +34,7 @@ func TestEngine_ListTournamentTeams(t *testing.T) { 0, }, { "unknown-tournament-id", - &ListTournamentTeamsInput{TournamentID: "does not exist"}, + &ListTournamentTeamsInput{TournamentID: -42}, // -42 should not exists ErrInvalidArgument, 0, }, { diff --git a/go/pkg/pwengine/api_pub_ping_test.go b/go/pkg/pwengine/api_pub_ping_test.go index 4d09caa4c..85dc87e8d 100644 --- a/go/pkg/pwengine/api_pub_ping_test.go +++ b/go/pkg/pwengine/api_pub_ping_test.go @@ -4,10 +4,12 @@ import ( "context" "reflect" "testing" + + "pathwar.land/go/internal/testutil" ) func TestEngine_GetInfo(t *testing.T) { - engine, cleanup := TestingEngine(t, Opts{}) + engine, cleanup := TestingEngine(t, Opts{Logger: testutil.Logger(t)}) defer cleanup() ctx := context.Background() diff --git a/go/pkg/pwengine/api_pub_setpreferences.go b/go/pkg/pwengine/api_pub_setpreferences.go index caa121eb4..466edd6c3 100644 --- a/go/pkg/pwengine/api_pub_setpreferences.go +++ b/go/pkg/pwengine/api_pub_setpreferences.go @@ -8,9 +8,9 @@ import ( ) func (e *engine) SetPreferences(ctx context.Context, in *SetPreferencesInput) (*Void, error) { - userID, err := subjectFromContext(ctx) + userID, err := userIDFromContext(ctx, e.db) if err != nil { - return nil, fmt.Errorf("failed to get subject from context: %w", err) + return nil, fmt.Errorf("get userid from context: %w", err) } var ( @@ -19,7 +19,7 @@ func (e *engine) SetPreferences(ctx context.Context, in *SetPreferencesInput) (* ) // update active tournament - if in.ActiveTournamentID != "" { + if in.ActiveTournamentID != 0 { hasChanges = true // get active tournament @@ -35,11 +35,11 @@ func (e *engine) SetPreferences(ctx context.Context, in *SetPreferencesInput) (* case err == nil && len(tournamentIDs) == 0: return nil, ErrInvalidArgument default: - return nil, fmt.Errorf("failed to get tournament: %w", err) + return nil, fmt.Errorf("get tournament: %w", err) } // get active tournament membership (optional) - var tournamentMemberIDs []string + var tournamentMemberIDs []int64 err = e.db. Table("tournament_member"). Joins("left join tournament_team ON tournament_team.id = tournament_member.tournament_team_id"). @@ -51,9 +51,9 @@ func (e *engine) SetPreferences(ctx context.Context, in *SetPreferencesInput) (* case err == nil && len(tournamentMemberIDs) == 1: updates["active_tournament_member_id"] = tournamentMemberIDs[0] case err == nil && len(tournamentMemberIDs) == 0: - updates["active_tournament_member_id"] = "" // nil instead? + updates["active_tournament_member_id"] = 0 // nil instead? default: - return nil, fmt.Errorf("failed to get tournament team: %w", err) + return nil, fmt.Errorf("get tournament team: %w", err) } } @@ -63,7 +63,7 @@ func (e *engine) SetPreferences(ctx context.Context, in *SetPreferencesInput) (* err = e.db.Model(pwdb.User{}).Where("id = ?", userID).Updates(updates).Error if err != nil { - return nil, fmt.Errorf("failed to update user: %w", err) + return nil, fmt.Errorf("update user: %w", err) } // FIXME: check amount of updated rows diff --git a/go/pkg/pwengine/api_pub_setpreferences_test.go b/go/pkg/pwengine/api_pub_setpreferences_test.go index 68f979649..a559edab2 100644 --- a/go/pkg/pwengine/api_pub_setpreferences_test.go +++ b/go/pkg/pwengine/api_pub_setpreferences_test.go @@ -4,19 +4,21 @@ import ( "context" "errors" "testing" + + "pathwar.land/go/internal/testutil" ) func TestEngine_SetPreferences(t *testing.T) { - engine, cleanup := TestingEngine(t, Opts{}) + engine, cleanup := TestingEngine(t, Opts{Logger: testutil.Logger(t)}) defer cleanup() - ctx := testSetContextToken(t, context.Background()) + ctx := testingSetContextToken(context.Background(), t) // get user session before setting preferences beforeSession, err := engine.GetUserSession(ctx, nil) if err != nil { t.Fatalf("err: %v", err) } - tournaments := map[string]string{} + tournaments := map[string]int64{} for _, tournament := range beforeSession.Tournaments { tournaments[tournament.Tournament.Name] = tournament.Tournament.ID } @@ -25,8 +27,8 @@ func TestEngine_SetPreferences(t *testing.T) { name string input *SetPreferencesInput expectedErr error - expectedTournamentID string - expectedTournamentMemberID string + expectedTournamentID int64 + expectedTournamentMemberID int64 }{ { "empty", @@ -36,7 +38,7 @@ func TestEngine_SetPreferences(t *testing.T) { beforeSession.User.ActiveTournamentMemberID, }, { "unknown-tournament-id", - &SetPreferencesInput{ActiveTournamentID: "does not exist"}, + &SetPreferencesInput{ActiveTournamentID: -42}, // should not exists ErrInvalidArgument, tournaments["Solo Mode"], beforeSession.User.ActiveTournamentMemberID, @@ -51,9 +53,9 @@ func TestEngine_SetPreferences(t *testing.T) { &SetPreferencesInput{ActiveTournamentID: tournaments["Test Tournament"]}, nil, tournaments["Test Tournament"], - "", + 0, }, { - "solo-mode", + "solo-mode-again", &SetPreferencesInput{ActiveTournamentID: tournaments["Solo Mode"]}, nil, tournaments["Solo Mode"], @@ -62,23 +64,21 @@ func TestEngine_SetPreferences(t *testing.T) { } for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - _, err := engine.SetPreferences(ctx, test.input) - if !errors.Is(err, test.expectedErr) { - t.Fatalf("Expected %#v, got %#v.", test.expectedErr, err) - } + _, err := engine.SetPreferences(ctx, test.input) + if !errors.Is(err, test.expectedErr) { + t.Fatalf("%s: Expected %#v, got %#v.", test.name, test.expectedErr, err) + } - session, err := engine.GetUserSession(ctx, nil) - if err != nil { - t.Fatalf("err: %v", err) - } + session, err := engine.GetUserSession(ctx, nil) + if err != nil { + t.Fatalf("%s: err: %v", test.name, err) + } - if session.User.ActiveTournamentID != test.expectedTournamentID { - t.Fatalf("Expected %s, got %s.", test.expectedTournamentID, session.User.ActiveTournamentID) - } - if session.User.ActiveTournamentMemberID != test.expectedTournamentMemberID { - t.Fatalf("Expected %s, got %s.", test.expectedTournamentMemberID, session.User.ActiveTournamentMemberID) - } - }) + if session.User.ActiveTournamentID != test.expectedTournamentID { + t.Fatalf("%s: Expected %d, got %d.", test.name, test.expectedTournamentID, session.User.ActiveTournamentID) + } + if session.User.ActiveTournamentMemberID != test.expectedTournamentMemberID { + t.Fatalf("%s: Expected %d, got %d.", test.name, test.expectedTournamentMemberID, session.User.ActiveTournamentMemberID) + } } } diff --git a/go/pkg/pwengine/auth.go b/go/pkg/pwengine/auth.go index e810da7a6..b912043e4 100644 --- a/go/pkg/pwengine/auth.go +++ b/go/pkg/pwengine/auth.go @@ -2,14 +2,16 @@ package pwengine import ( "context" + "errors" "fmt" "strings" "github.com/dgrijalva/jwt-go" - "github.com/pkg/errors" + "github.com/jinzhu/gorm" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "pathwar.land/go/pkg/pwdb" "pathwar.land/go/pkg/pwsso" ) @@ -65,7 +67,7 @@ func tokenFromContext(ctx context.Context) (*jwt.Token, error) { func subjectFromContext(ctx context.Context) (string, error) { token, err := tokenFromContext(ctx) if err != nil { - return "", fmt.Errorf("failed to get token from contact: %w", err) + return "", fmt.Errorf("get token from contact: %w", err) } sub := pwsso.SubjectFromToken(token) @@ -75,3 +77,26 @@ func subjectFromContext(ctx context.Context) (string, error) { return sub, nil } + +func userIDFromContext(ctx context.Context, db *gorm.DB) (int64, error) { + oauthSubject, err := subjectFromContext(ctx) + if err != nil { + return 0, fmt.Errorf("get OAuth subject from context: %w", err) + } + + // FIXME: only fetch the ID instead of the whole user + var user pwdb.User + err = db. + Where(pwdb.User{OAuthSubject: oauthSubject}). + Find(&user). + Error + + switch { + case err != nil && !pwdb.IsRecordNotFoundError(err): + return 0, fmt.Errorf("get user by OAuth subject: %w", err) + case pwdb.IsRecordNotFoundError(err): + return 0, errors.New("no such user with oauth subject") + } + + return user.ID, nil +} diff --git a/go/pkg/pwengine/auth_test.go b/go/pkg/pwengine/auth_test.go deleted file mode 100644 index ffadde473..000000000 --- a/go/pkg/pwengine/auth_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package pwengine - -import ( - "context" - "testing" - - "pathwar.land/go/pkg/pwsso" -) - -func testSetContextToken(t *testing.T, ctx context.Context) context.Context { - t.Helper() - - return context.WithValue(ctx, userTokenCtx, pwsso.TestingToken(t)) -} diff --git a/go/pkg/pwengine/engine.go b/go/pkg/pwengine/engine.go index d6de83118..4b4b15575 100644 --- a/go/pkg/pwengine/engine.go +++ b/go/pkg/pwengine/engine.go @@ -1,8 +1,10 @@ package pwengine import ( + "fmt" "time" + "github.com/bwmarrin/snowflake" "github.com/jinzhu/gorm" "go.uber.org/zap" "pathwar.land/go/pkg/pwsso" @@ -20,22 +22,39 @@ type engine struct { db *gorm.DB opts Opts sso pwsso.Client + snowflake *snowflake.Node startedAt time.Time logger *zap.Logger } type Opts struct { - Logger *zap.Logger + Logger *zap.Logger + Snowflake *snowflake.Node } func New(db *gorm.DB, sso pwsso.Client, opts Opts) (Engine, error) { - return &engine{ + engine := &engine{ logger: opts.Logger, + snowflake: opts.Snowflake, db: db, opts: opts, sso: sso, startedAt: time.Now(), - }, nil + } + + if engine.logger == nil { + engine.logger = zap.NewNop() + } + + if engine.snowflake == nil { + var err error + engine.snowflake, err = snowflake.NewNode(1) + if err != nil { + return nil, fmt.Errorf("init snowflake: %w", err) + } + } + + return engine, nil } func (e *engine) Close() error { diff --git a/go/pkg/pwengine/pwengine.pb.go b/go/pkg/pwengine/pwengine.pb.go index 93537b11e..bf01969c9 100644 --- a/go/pkg/pwengine/pwengine.pb.go +++ b/go/pkg/pwengine/pwengine.pb.go @@ -70,7 +70,7 @@ func (m *Void) XXX_DiscardUnknown() { var xxx_messageInfo_Void proto.InternalMessageInfo type ListTournamentTeamsInput struct { - TournamentID string `protobuf:"bytes,1,opt,name=tournament_id,json=tournamentId,proto3" json:"tournament_id,omitempty"` + TournamentID int64 `protobuf:"varint,1,opt,name=tournament_id,json=tournamentId,proto3" json:"tournament_id,omitempty"` } func (m *ListTournamentTeamsInput) Reset() { *m = ListTournamentTeamsInput{} } @@ -106,15 +106,15 @@ func (m *ListTournamentTeamsInput) XXX_DiscardUnknown() { var xxx_messageInfo_ListTournamentTeamsInput proto.InternalMessageInfo -func (m *ListTournamentTeamsInput) GetTournamentID() string { +func (m *ListTournamentTeamsInput) GetTournamentID() int64 { if m != nil { return m.TournamentID } - return "" + return 0 } type SetPreferencesInput struct { - ActiveTournamentID string `protobuf:"bytes,1,opt,name=active_tournament_id,json=activeTournamentId,proto3" json:"active_tournament_id,omitempty"` + ActiveTournamentID int64 `protobuf:"varint,1,opt,name=active_tournament_id,json=activeTournamentId,proto3" json:"active_tournament_id,omitempty"` } func (m *SetPreferencesInput) Reset() { *m = SetPreferencesInput{} } @@ -150,11 +150,11 @@ func (m *SetPreferencesInput) XXX_DiscardUnknown() { var xxx_messageInfo_SetPreferencesInput proto.InternalMessageInfo -func (m *SetPreferencesInput) GetActiveTournamentID() string { +func (m *SetPreferencesInput) GetActiveTournamentID() int64 { if m != nil { return m.ActiveTournamentID } - return "" + return 0 } type UserSessionOutput struct { @@ -426,83 +426,83 @@ func init() { func init() { proto.RegisterFile("pwengine.proto", fileDescriptor_02cf22bbbf1a21c2) } var fileDescriptor_02cf22bbbf1a21c2 = []byte{ - // 1202 bytes of a gzipped FileDescriptorProto + // 1203 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x4f, 0x73, 0xdb, 0x44, 0x14, 0x8f, 0x1c, 0xc7, 0xb1, 0xd7, 0xb5, 0x93, 0x6c, 0x4a, 0xea, 0x98, 0xe2, 0x08, 0xd1, 0x43, 0x08, 0x63, 0x29, 0xb8, 0x85, 0xe9, 0x04, 0x0e, 0x38, 0x4d, 0xeb, 0x9a, 0x52, 0x62, 0x94, 0xb4, 0x03, 0xbd, 0x98, 0xb5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 0x4b, 0x0b, 0xea, 0xfc, 0x66, 0xbe, 0x76, 0x53, 0x3f, 0xdb, 0x56, 0xfa, 0x85, 0x0b, 0xe9, - 0x93, 0x3b, 0xd7, 0x3d, 0x3b, 0x2a, 0x8b, 0x99, 0xe4, 0x29, 0xff, 0xac, 0xa0, 0x95, 0x0b, 0x10, - 0xfc, 0x2e, 0x42, 0x13, 0x50, 0x9c, 0x8b, 0xb5, 0x64, 0x2e, 0x26, 0x26, 0x66, 0x02, 0x89, 0x75, - 0x94, 0x16, 0x40, 0x5c, 0x99, 0x90, 0x7c, 0xad, 0x3c, 0xdd, 0x42, 0x06, 0x21, 0x71, 0xf8, 0x55, - 0x94, 0xa3, 0xbc, 0x3d, 0x2a, 0x8e, 0x4c, 0x55, 0xd6, 0xcc, 0x52, 0x3e, 0x2a, 0xa0, 0x76, 0x0f, - 0x65, 0x0e, 0x04, 0x11, 0x21, 0xc7, 0xef, 0xa3, 0x65, 0x38, 0x86, 0x60, 0x28, 0x7a, 0xd4, 0x73, - 0xda, 0x94, 0xb7, 0xd9, 0x91, 0x0c, 0x2a, 0xbb, 0x8b, 0x4f, 0x9e, 0x6f, 0x14, 0xef, 0x9e, 0x9e, - 0x35, 0xf9, 0xfe, 0x03, 0xb3, 0x08, 0x49, 0xf9, 0x48, 0xfb, 0x5e, 0x41, 0xe9, 0xa6, 0xd7, 0x65, - 0xb8, 0x84, 0x16, 0x8f, 0x21, 0x88, 0x72, 0x33, 0x6a, 0x17, 0x73, 0x2c, 0xe2, 0x35, 0x94, 0x09, - 0x7d, 0x41, 0x5d, 0x90, 0x91, 0x2f, 0x98, 0xb1, 0x14, 0xe9, 0x2d, 0xe6, 0xba, 0x54, 0xc8, 0xe0, - 0x72, 0x66, 0x2c, 0xe1, 0x75, 0x94, 0xed, 0x84, 0xb4, 0x2f, 0xda, 0x44, 0xc8, 0x6a, 0xe5, 0xcc, - 0x45, 0x29, 0xd7, 0x13, 0x47, 0x9d, 0x61, 0x69, 0x21, 0x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, 0x67, 0x6a, + 0x69, 0x9c, 0xfa, 0xe6, 0x5b, 0xed, 0x13, 0x54, 0xfa, 0x88, 0x72, 0x71, 0xc8, 0xc2, 0xc0, 0x23, + 0x2e, 0x78, 0xe2, 0x10, 0x88, 0xcb, 0x9b, 0x9e, 0x1f, 0x0a, 0xfc, 0x0e, 0x2a, 0x88, 0x53, 0x7f, + 0x9b, 0xda, 0x25, 0x45, 0x55, 0x36, 0xe7, 0x77, 0x97, 0x4f, 0x9e, 0x6f, 0x5c, 0x99, 0x10, 0x9a, + 0x7b, 0xe6, 0x95, 0x09, 0xac, 0x69, 0x6b, 0x6d, 0xb4, 0x7a, 0x00, 0xa2, 0x15, 0x40, 0x17, 0x02, + 0xf0, 0x2c, 0x88, 0xd5, 0xee, 0xa3, 0xab, 0xc4, 0x12, 0xf4, 0x18, 0xda, 0xd3, 0x44, 0xd7, 0x4e, + 0x9e, 0x6f, 0xe0, 0xba, 0x5c, 0x3f, 0x23, 0x8d, 0xc9, 0x79, 0x9f, 0xad, 0xfd, 0x3a, 0x8f, 0x56, + 0x1e, 0x71, 0x08, 0x0e, 0x80, 0x73, 0xca, 0xbc, 0xfd, 0x50, 0x44, 0xfa, 0x37, 0x50, 0x3a, 0xe4, + 0x10, 0x48, 0xbd, 0x7c, 0x6d, 0x59, 0x1f, 0x97, 0xcd, 0xee, 0xe8, 0x11, 0xd8, 0x94, 0xab, 0xb8, + 0x82, 0xf2, 0x94, 0xb7, 0x3d, 0x18, 0xb4, 0x25, 0x38, 0xa5, 0x2a, 0x9b, 0x59, 0x33, 0x47, 0xf9, + 0xc7, 0x30, 0x88, 0x50, 0xf8, 0x2d, 0x94, 0xb1, 0xfa, 0x84, 0xba, 0xbc, 0x34, 0x2f, 0x75, 0x56, + 0x4f, 0x75, 0xa2, 0x94, 0xde, 0x91, 0x4b, 0x66, 0x0c, 0xc1, 0x37, 0x50, 0xc1, 0x63, 0x82, 0x76, + 0xa9, 0x35, 0xca, 0x7f, 0x29, 0xad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x21, 0x0b, + 0x40, 0x25, 0x1d, 0x16, 0x0a, 0x35, 0x2e, 0xe4, 0xcb, 0x94, 0xf0, 0x8f, 0x93, 0x8a, 0xf2, 0xec, + 0xa4, 0xa2, 0xfc, 0x7d, 0x52, 0x51, 0x7e, 0x7c, 0x51, 0x99, 0x7b, 0xf6, 0xa2, 0x32, 0xf7, 0xd7, + 0x8b, 0xca, 0xdc, 0x93, 0xeb, 0xc9, 0x64, 0x1b, 0xd1, 0x5b, 0xeb, 0xc8, 0x31, 0xc6, 0xaf, 0xb7, + 0x4e, 0x46, 0xbe, 0x79, 0x6e, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x2d, 0xc4, 0x8a, 0xd0, + 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -962,12 +962,10 @@ func (m *ListTournamentTeamsInput) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if len(m.TournamentID) > 0 { - i -= len(m.TournamentID) - copy(dAtA[i:], m.TournamentID) - i = encodeVarintPwengine(dAtA, i, uint64(len(m.TournamentID))) + if m.TournamentID != 0 { + i = encodeVarintPwengine(dAtA, i, uint64(m.TournamentID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -992,12 +990,10 @@ func (m *SetPreferencesInput) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ActiveTournamentID) > 0 { - i -= len(m.ActiveTournamentID) - copy(dAtA[i:], m.ActiveTournamentID) - i = encodeVarintPwengine(dAtA, i, uint64(len(m.ActiveTournamentID))) + if m.ActiveTournamentID != 0 { + i = encodeVarintPwengine(dAtA, i, uint64(m.ActiveTournamentID)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -1250,9 +1246,8 @@ func (m *ListTournamentTeamsInput) Size() (n int) { } var l int _ = l - l = len(m.TournamentID) - if l > 0 { - n += 1 + l + sovPwengine(uint64(l)) + if m.TournamentID != 0 { + n += 1 + sovPwengine(uint64(m.TournamentID)) } return n } @@ -1263,9 +1258,8 @@ func (m *SetPreferencesInput) Size() (n int) { } var l int _ = l - l = len(m.ActiveTournamentID) - if l > 0 { - n += 1 + l + sovPwengine(uint64(l)) + if m.ActiveTournamentID != 0 { + n += 1 + sovPwengine(uint64(m.ActiveTournamentID)) } return n } @@ -1448,10 +1442,10 @@ func (m *ListTournamentTeamsInput) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TournamentID", wireType) } - var stringLen uint64 + m.TournamentID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwengine @@ -1461,24 +1455,11 @@ func (m *ListTournamentTeamsInput) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TournamentID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwengine - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwengine - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TournamentID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwengine(dAtA[iNdEx:]) @@ -1533,10 +1514,10 @@ func (m *SetPreferencesInput) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ActiveTournamentID", wireType) } - var stringLen uint64 + m.ActiveTournamentID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPwengine @@ -1546,24 +1527,11 @@ func (m *SetPreferencesInput) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ActiveTournamentID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPwengine - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPwengine - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ActiveTournamentID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPwengine(dAtA[iNdEx:]) diff --git a/go/pkg/pwengine/testing.go b/go/pkg/pwengine/testing.go index 089e5d007..60fe9fa3f 100644 --- a/go/pkg/pwengine/testing.go +++ b/go/pkg/pwengine/testing.go @@ -21,7 +21,7 @@ func TestingEngine(t *testing.T, opts Opts) (Engine, func()) { engine, err := New(db, sso, opts) if err != nil { - t.Fatalf("failed to initialize engine: %v", err) + t.Fatalf("init engine: %v", err) } cleanup := func() { diff --git a/go/pkg/pwengine/testing_test.go b/go/pkg/pwengine/testing_test.go index 96ea0f019..4773353f8 100644 --- a/go/pkg/pwengine/testing_test.go +++ b/go/pkg/pwengine/testing_test.go @@ -1,10 +1,12 @@ package pwengine import ( + "context" "testing" "github.com/jinzhu/gorm" "pathwar.land/go/pkg/pwdb" + "pathwar.land/go/pkg/pwsso" ) func testingTournaments(t *testing.T, e Engine) *pwdb.TournamentList { @@ -14,7 +16,7 @@ func testingTournaments(t *testing.T, e Engine) *pwdb.TournamentList { var list pwdb.TournamentList err := db.Find(&list.Items).Error if err != nil { - t.Fatalf("failed to list tournaments: %v", err) + t.Fatalf("list tournaments: %v", err) } return &list @@ -26,3 +28,9 @@ func testingEngineDB(t *testing.T, e Engine) *gorm.DB { typed := e.(*engine) return typed.db } + +func testingSetContextToken(ctx context.Context, t *testing.T) context.Context { + t.Helper() + + return context.WithValue(ctx, userTokenCtx, pwsso.TestingToken(t)) +} diff --git a/go/pkg/pwserver/server.go b/go/pkg/pwserver/server.go index e3981fa1c..eace46796 100644 --- a/go/pkg/pwserver/server.go +++ b/go/pkg/pwserver/server.go @@ -65,7 +65,7 @@ func Start(ctx context.Context, engine pwengine.Engine, opts Opts) (func() error grpcListener, err := net.Listen("tcp", opts.GRPCBind) if err != nil { - return nil, nil, fmt.Errorf("failed to start gRPC listener: %w", err) + return nil, nil, fmt.Errorf("start gRPC listener: %w", err) } { // gRPC server authFunc := func(context.Context) (context.Context, error) { @@ -126,7 +126,7 @@ func Start(ctx context.Context, engine pwengine.Engine, opts Opts) (func() error ) grpcOpts := []grpc.DialOption{grpc.WithInsecure()} if err := pwengine.RegisterEngineHandlerFromEndpoint(ctx, gwmux, opts.GRPCBind, grpcOpts); err != nil { - return nil, nil, fmt.Errorf("failed to register service on gateway: %w", err) + return nil, nil, fmt.Errorf("register service on gateway: %w", err) } r.Mount("/", gwmux) if opts.WithPprof { @@ -148,14 +148,14 @@ func Start(ctx context.Context, engine pwengine.Engine, opts Opts) (func() error ctx, cancel := context.WithTimeout(ctx, opts.ShutdownTimeout) defer cancel() if err := srv.Shutdown(ctx); err != nil { - httpLogger.Warn("failed to shutdown HTTP server", zap.Error(err)) + httpLogger.Warn("shutdown HTTP server", zap.Error(err)) } }) } cleaner := func() { if err := grpcListener.Close(); err != nil { - grpcLogger.Warn("failed to close gRPC listener", zap.Error(err)) + grpcLogger.Warn("close gRPC listener", zap.Error(err)) } } diff --git a/go/pkg/pwserver/testing.go b/go/pkg/pwserver/testing.go index b83c389b4..4616ac1ca 100644 --- a/go/pkg/pwserver/testing.go +++ b/go/pkg/pwserver/testing.go @@ -13,7 +13,7 @@ func TestingServer(t *testing.T, ctx context.Context, opts Opts) (func() error, engine, engineCleanup := pwengine.TestingEngine(t, pwengine.Opts{Logger: opts.Logger}) start, serverCleanup, err := Start(ctx, engine, opts) if err != nil { - t.Fatalf("failed to initialize server: %v", err) + t.Fatalf("init server: %v", err) } cleanup := func() { diff --git a/go/pkg/pwsso/client.go b/go/pkg/pwsso/client.go index ee832f777..0f4813890 100644 --- a/go/pkg/pwsso/client.go +++ b/go/pkg/pwsso/client.go @@ -50,7 +50,7 @@ func New(publicKey string, realm string, opts Opts) (Client, error) { } parsedKey, err := x509.ParsePKIXPublicKey(pubPem.Bytes) if err != nil { - return nil, fmt.Errorf("failed to parse public key: %w", err) + return nil, fmt.Errorf("parse public key: %w", err) } c.publicKey = parsedKey } diff --git a/go/pkg/pwsso/keycloak.go b/go/pkg/pwsso/keycloak.go index 493002451..e881b1673 100644 --- a/go/pkg/pwsso/keycloak.go +++ b/go/pkg/pwsso/keycloak.go @@ -16,17 +16,17 @@ const ( func (c *client) Whoami(token string) (map[string]interface{}, error) { oidc, err := c.oidc() if err != nil { - return nil, fmt.Errorf("failed to get oidc: %w", err) + return nil, fmt.Errorf("get oidc: %w", err) } res, err := oidc.Path("userinfo").Request().Header("Authorization", "brear "+token).Get() if err != nil { - return nil, fmt.Errorf("failed to get userinfo from keycloak: %w", err) + return nil, fmt.Errorf("get userinfo from keycloak: %w", err) } var info map[string]interface{} if err := res.ReadJson(&info); err != nil { - return nil, fmt.Errorf("failed to read JSON from keycloak response: %w", err) + return nil, fmt.Errorf("read JSON from keycloak response: %w", err) } return info, nil @@ -35,7 +35,7 @@ func (c *client) Whoami(token string) (map[string]interface{}, error) { func (c *client) Logout(token string) error { oidc, err := c.oidc() if err != nil { - return fmt.Errorf("failed to get oidc: %w", err) + return fmt.Errorf("get oidc: %w", err) } form := url.Values{} @@ -44,11 +44,11 @@ func (c *client) Logout(token string) error { form.Set("refresh_token", token) res, err := oidc.Path("logout").Request().Form(form).Post() if err != nil { - return fmt.Errorf("failed to logout from keycloak: %w", err) + return fmt.Errorf("logout from keycloak: %w", err) } var ret map[string]interface{} if err := res.ReadJson(&ret); err != nil { - return fmt.Errorf("failed to read result from keycloak: %w", err) + return fmt.Errorf("read result from keycloak: %w", err) } c.logger.Debug("keycloak returned", zap.Any("ret", ret)) if _, ok := ret["error"]; ok { @@ -62,7 +62,7 @@ func (c *client) oidc() (*rest.WebTarget, error) { realmURL := fmt.Sprintf("%s/realms/%s", keycloakBaseURL, c.realm) base := keycloak.Target(realmURL) if base == nil { - return nil, errors.New("failed to initialize keycloak client") + return nil, errors.New("init keycloak client") } oidc := base.Path("protocol/openid-connect") return oidc, nil diff --git a/go/pkg/pwsso/testing.go b/go/pkg/pwsso/testing.go index 443bc31b4..2399410f2 100644 --- a/go/pkg/pwsso/testing.go +++ b/go/pkg/pwsso/testing.go @@ -25,7 +25,7 @@ func TestingToken(t *testing.T) *jwt.Token { t.Helper() token, _, err := TokenWithClaims(testingToken, testingPubKey, true) if err != nil { - t.Fatalf("failed to parse token: %v", err) + t.Fatalf("parse token: %v", err) } return token } @@ -39,7 +39,7 @@ func TestingSSO(t *testing.T, logger *zap.Logger) Client { } sso, err := New(testingPubKey, testingRealm, ssoOpts) if err != nil { - t.Fatalf("failed to initialize SSO: %v", err) + t.Fatalf("init SSO: %v", err) } return sso diff --git a/swagger.yaml b/swagger.yaml index bfbe5835f..86975ba0c 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -40,10 +40,12 @@ definitions: author: $ref: '#/definitions/dbTournamentMember' author_id: + format: int64 type: string challenge_validation: $ref: '#/definitions/dbChallengeValidation' challenge_validation_id: + format: int64 type: string comment: type: string @@ -51,6 +53,7 @@ definitions: format: date-time type: string id: + format: int64 type: string is_global: format: boolean @@ -112,6 +115,7 @@ definitions: title: repeated string tags = ; type: string id: + format: int64 type: string is_draft: format: boolean @@ -134,13 +138,15 @@ definitions: dbChallengeFlavor: properties: challenge_version: - $ref: '#/definitions/dbChallenge' + $ref: '#/definitions/dbChallengeVersion' challenge_version_id: + format: int64 type: string created_at: format: date-time type: string id: + format: int64 type: string instances: items: @@ -158,12 +164,15 @@ definitions: flavor: $ref: '#/definitions/dbChallengeFlavor' flavor_id: + format: int64 type: string hypervisor: $ref: '#/definitions/dbHypervisor' hypervisor_id: + format: int64 type: string id: + format: int64 type: string status: $ref: '#/definitions/dbChallengeInstanceStatus' @@ -190,15 +199,18 @@ definitions: challenge_flavor: $ref: '#/definitions/dbChallengeFlavor' challenge_flavor_id: + format: int64 type: string created_at: format: date-time type: string id: + format: int64 type: string tournament_team: $ref: '#/definitions/dbTournamentTeam' tournament_team_id: + format: int64 type: string updated_at: format: date-time @@ -215,6 +227,7 @@ definitions: challenge_subscription: $ref: '#/definitions/dbChallengeSubscription' challenge_subscription_id: + format: int64 type: string corrector_comment: type: string @@ -222,12 +235,14 @@ definitions: format: date-time type: string id: + format: int64 type: string status: $ref: '#/definitions/dbChallengeValidationStatus' tournament_member: $ref: '#/definitions/dbTournamentMember' tournament_member_id: + format: int64 type: string updated_at: format: date-time @@ -247,6 +262,7 @@ definitions: challenge: $ref: '#/definitions/dbChallenge' challenge_id: + format: int64 type: string changelog: type: string @@ -260,6 +276,7 @@ definitions: $ref: '#/definitions/dbChallengeFlavor' type: array id: + format: int64 type: string is_draft: format: boolean @@ -284,6 +301,7 @@ definitions: title: fields type: string id: + format: int64 type: string max_validation_count: format: int32 @@ -292,6 +310,7 @@ definitions: $ref: '#/definitions/dbTournament' title: associations tournament_id: + format: int64 type: string updated_at: format: date-time @@ -310,6 +329,7 @@ definitions: $ref: '#/definitions/dbTournamentMember' title: associations author_id: + format: int64 type: string comment: title: fields @@ -317,11 +337,13 @@ definitions: coupon: $ref: '#/definitions/dbCoupon' coupon_id: + format: int64 type: string created_at: format: date-time type: string id: + format: int64 type: string updated_at: format: date-time @@ -418,6 +440,7 @@ definitions: format: date-time type: string id: + format: int64 type: string name: type: string @@ -440,12 +463,14 @@ definitions: format: date-time type: string id: + format: int64 type: string item: $ref: '#/definitions/InventoryItemItem' owner: $ref: '#/definitions/dbTournamentMember' owner_id: + format: int64 type: string updated_at: format: date-time @@ -461,6 +486,7 @@ definitions: format: date-time type: string id: + format: int64 type: string is_read: format: boolean @@ -473,6 +499,7 @@ definitions: user: $ref: '#/definitions/dbUser' user_id: + format: int64 type: string type: object dbTeam: @@ -483,6 +510,7 @@ definitions: gravatar_url: type: string id: + format: int64 type: string locale: type: string @@ -517,12 +545,14 @@ definitions: format: date-time type: string id: + format: int64 type: string role: $ref: '#/definitions/dbTeamMemberRole' team: $ref: '#/definitions/dbTeam' team_id: + format: int64 type: string updated_at: format: date-time @@ -530,6 +560,7 @@ definitions: user: $ref: '#/definitions/dbUser' user_id: + format: int64 type: string type: object dbTeamMemberRole: @@ -549,6 +580,7 @@ definitions: format: date-time type: string id: + format: int64 type: string is_default: format: boolean @@ -585,6 +617,7 @@ definitions: format: date-time type: string id: + format: int64 type: string items: items: @@ -603,6 +636,7 @@ definitions: tournament_team: $ref: '#/definitions/dbTournamentTeam' tournament_team_id: + format: int64 type: string updated_at: format: date-time @@ -610,6 +644,7 @@ definitions: user: $ref: '#/definitions/dbUser' user_id: + format: int64 type: string type: object dbTournamentMemberRole: @@ -636,6 +671,7 @@ definitions: format: date-time type: string id: + format: int64 type: string is_default: format: boolean @@ -647,10 +683,12 @@ definitions: team: $ref: '#/definitions/dbTeam' team_id: + format: int64 type: string tournament: $ref: '#/definitions/dbTournament' tournament_id: + format: int64 type: string updated_at: format: date-time @@ -668,10 +706,12 @@ definitions: active_tournament: $ref: '#/definitions/dbTournamentMember' active_tournament_id: + format: int64 type: string active_tournament_member: $ref: '#/definitions/dbTournamentMember' active_tournament_member_id: + format: int64 type: string created_at: format: date-time @@ -681,6 +721,7 @@ definitions: gravatar_url: type: string id: + format: int64 type: string locale: type: string @@ -692,6 +733,8 @@ definitions: items: $ref: '#/definitions/dbNotification' type: array + oauth_subject: + type: string tournament_memberships: items: $ref: '#/definitions/dbTournamentMember' @@ -711,11 +754,13 @@ definitions: $ref: '#/definitions/dbTournamentMember' title: associations author_id: + format: int64 type: string created_at: format: date-time type: string id: + format: int64 type: string success: format: boolean @@ -724,10 +769,12 @@ definitions: target_member: $ref: '#/definitions/dbTournamentMember' target_member_id: + format: int64 type: string target_team: $ref: '#/definitions/dbTournamentTeam' target_team_id: + format: int64 type: string updated_at: format: date-time @@ -736,6 +783,7 @@ definitions: engineSetPreferencesInput: properties: active_tournament_id: + format: int64 type: string type: object engineUserSessionOutput: @@ -1011,7 +1059,8 @@ paths: get: operationId: ListTournamentTeams parameters: - - in: query + - format: int64 + in: query name: tournament_id required: false type: string