userids and asset ids are uint64

This commit is contained in:
Quaternions 2024-12-10 19:18:04 -08:00
parent b49ae10a10
commit 3e58d75b87
3 changed files with 19 additions and 19 deletions

View File

@ -25,10 +25,10 @@ type Submission struct {
GameID int32 GameID int32
CreatedAt time.Time CreatedAt time.Time
UpdatedAt time.Time UpdatedAt time.Time
Submitter int64 // UserID Submitter uint64 // UserID
AssetID int64 AssetID uint64
AssetVersion int64 AssetVersion uint64
Completed bool // Has this version of the map been completed at least once on maptest Completed bool // Has this version of the map been completed at least once on maptest
TargetAssetID int64 // where to upload map fix. if the TargetAssetID is 0, it's a new map. TargetAssetID uint64 // where to upload map fix. if the TargetAssetID is 0, it's a new map.
StatusID Status StatusID Status
} }

View File

@ -33,10 +33,10 @@ type Roles struct {
type UserInfo struct { type UserInfo struct {
Roles Roles Roles Roles
UserID int64 UserID uint64
} }
func (usr UserInfo) IsSubmitter(submitter int64) bool{ func (usr UserInfo) IsSubmitter(submitter uint64) bool{
return usr.UserID == submitter return usr.UserID == submitter
} }
@ -88,7 +88,7 @@ func (svc SecurityHandler) HandleCookieAuth(ctx context.Context, operationName a
newCtx := context.WithValue(ctx, "UserInfo", UserInfo{ newCtx := context.WithValue(ctx, "UserInfo", UserInfo{
Roles: roles, Roles: roles,
UserID: int64(session.UserID), UserID: session.UserID,
}) })
return newCtx, nil return newCtx, nil

View File

@ -25,11 +25,11 @@ func (svc *Service) CreateSubmission(ctx context.Context, request *api.Submissio
DisplayName: request.DisplayName, DisplayName: request.DisplayName,
Creator: request.Creator, Creator: request.Creator,
GameID: request.GameID, GameID: request.GameID,
Submitter: int64(userInfo.UserID), Submitter: userInfo.UserID,
AssetID: request.AssetID, AssetID: uint64(request.AssetID),
AssetVersion: request.AssetVersion, AssetVersion: uint64(request.AssetVersion),
Completed: false, Completed: false,
TargetAssetID: request.TargetAssetID.Value, TargetAssetID: uint64(request.TargetAssetID.Value),
StatusID: model.StatusUnderConstruction, StatusID: model.StatusUnderConstruction,
}) })
if err != nil{ if err != nil{
@ -57,11 +57,11 @@ func (svc *Service) GetSubmission(ctx context.Context, params api.GetSubmissionP
GameID: submission.GameID, GameID: submission.GameID,
CreatedAt: submission.CreatedAt.Unix(), CreatedAt: submission.CreatedAt.Unix(),
UpdatedAt: submission.UpdatedAt.Unix(), UpdatedAt: submission.UpdatedAt.Unix(),
Submitter: submission.Submitter, Submitter: int64(submission.Submitter),
AssetID: submission.AssetID, AssetID: int64(submission.AssetID),
AssetVersion: submission.AssetVersion, AssetVersion: int64(submission.AssetVersion),
Completed: submission.Completed, Completed: submission.Completed,
TargetAssetID: api.NewOptInt64(submission.TargetAssetID), TargetAssetID: api.NewOptInt64(int64(submission.TargetAssetID)),
StatusID: int32(submission.StatusID), StatusID: int32(submission.StatusID),
}, nil }, nil
} }
@ -97,11 +97,11 @@ func (svc *Service) ListSubmissions(ctx context.Context, request api.ListSubmiss
GameID: items[i].GameID, GameID: items[i].GameID,
CreatedAt: items[i].CreatedAt.Unix(), CreatedAt: items[i].CreatedAt.Unix(),
UpdatedAt: items[i].UpdatedAt.Unix(), UpdatedAt: items[i].UpdatedAt.Unix(),
Submitter: items[i].Submitter, Submitter: int64(items[i].Submitter),
AssetID: items[i].AssetID, AssetID: int64(items[i].AssetID),
AssetVersion: items[i].AssetVersion, AssetVersion: int64(items[i].AssetVersion),
Completed: items[i].Completed, Completed: items[i].Completed,
TargetAssetID: api.NewOptInt64(items[i].TargetAssetID), TargetAssetID: api.NewOptInt64(int64(items[i].TargetAssetID)),
StatusID: int32(items[i].StatusID), StatusID: int32(items[i].StatusID),
}) })
} }