This commit is contained in:
Quaternions 2025-04-09 15:09:46 -07:00
parent 1f1deacc2d
commit ccf1ff6866
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131
8 changed files with 29 additions and 24 deletions

@ -5,7 +5,7 @@ import (
"time"
)
type AuditEventType int32
type AuditEventType uint32
// User clicked "Submit", "Accept" etc
const AuditEventTypeAction AuditEventType = 0
@ -43,11 +43,11 @@ type AuditEventDataChangeName struct {
}
type AuditEvent struct {
ID int64 `gorm:"primaryKey"`
ID uint64 `gorm:"primaryKey"`
CreatedAt time.Time
User uint64
ResourceType ResourceType // is this a submission or is it a mapfix
ResourceID int64 // submission / mapfix / map ID
ResourceID uint64 // submission / mapfix / map ID
EventType AuditEventType
EventData json.RawMessage `gorm:"type:jsonb"`
}

@ -2,7 +2,7 @@ package model
import "time"
type MapfixStatus int32
type MapfixStatus uint32
const (
// Phase: Creation
@ -25,7 +25,7 @@ const (
)
type Mapfix struct {
ID int64 `gorm:"primaryKey"`
ID uint64 `gorm:"primaryKey"`
DisplayName string
Creator string
GameID uint32

@ -7,26 +7,26 @@ package model
type CreateSubmissionRequest struct {
// operation_id is passed back in the response message
OperationID int32
OperationID uint32
ModelID uint64
}
type CreateMapfixRequest struct {
OperationID int32
OperationID uint32
ModelID uint64
TargetAssetID uint64
}
type ValidateSubmissionRequest struct {
// submission_id is passed back in the response message
SubmissionID int64
SubmissionID uint64
ModelID uint64
ModelVersion uint64
ValidatedModelID *uint64 // optional value
}
type ValidateMapfixRequest struct {
MapfixID int64
MapfixID uint64
ModelID uint64
ModelVersion uint64
ValidatedModelID *uint64 // optional value
@ -34,14 +34,14 @@ type ValidateMapfixRequest struct {
// Create a new map
type UploadSubmissionRequest struct {
SubmissionID int64
SubmissionID uint64
ModelID uint64
ModelVersion uint64
ModelName string
}
type UploadMapfixRequest struct {
MapfixID int64
MapfixID uint64
ModelID uint64
ModelVersion uint64
TargetAssetID uint64

@ -2,7 +2,7 @@ package model
import "time"
type OperationStatus int32
type OperationStatus uint32
const (
OperationStatusCreated OperationStatus = 0
OperationStatusCompleted OperationStatus = 1
@ -10,7 +10,7 @@ const (
)
type Operation struct {
ID int32 `gorm:"primaryKey"`
ID uint32 `gorm:"primaryKey"`
CreatedAt time.Time
Owner uint64 // UserID
StatusID OperationStatus

@ -1,6 +1,6 @@
package model
type Page struct {
Number int32
Size int32
Number uint32
Size uint32
}

@ -2,7 +2,7 @@ package model
import "time"
type Policy int32
type Policy uint32
const (
ScriptPolicyNone Policy = 0 // not yet reviewed
@ -13,7 +13,7 @@ const (
)
type ScriptPolicy struct {
ID int64 `gorm:"primaryKey"`
ID uint64 `gorm:"primaryKey"`
// Hash of the source code that leads to this policy.
// If this is a replacement mapping, the original source may not be pointed to by any policy.
// The original source should still exist in the scripts table, which can be located by the same hash.
@ -21,7 +21,7 @@ type ScriptPolicy struct {
// The ID of the replacement source (ScriptPolicyReplace)
// or verbatim source (ScriptPolicyAllowed)
// or 0 (other)
ToScriptID int64
ToScriptID uint64
Policy Policy
CreatedAt time.Time
UpdatedAt time.Time

@ -23,7 +23,7 @@ func HashParse(hash string) (uint64, error){
return strconv.ParseUint(hash, 16, 64)
}
type ResourceType int32
type ResourceType uint32
const (
ResourceUnknown ResourceType = 0
ResourceMapfix ResourceType = 1
@ -31,12 +31,17 @@ const (
)
type Script struct {
ID int64 `gorm:"primaryKey"`
ID uint64 `gorm:"primaryKey"`
Name string
Hash int64 // postgres does not support unsigned integers, so we have to pretend
hash uint64
Source string
ResourceType ResourceType // is this a submission or is it a mapfix
ResourceID int64 // which submission / mapfix did this script first appear in
ResourceID uint64 // which submission / mapfix did this script first appear in
CreatedAt time.Time
UpdatedAt time.Time
}
// postgres does not support unsigned integers, so we have to pretend
func (script *Script) GetPostgresInt64() (int64) {
return int64(script.hash)
}

@ -2,7 +2,7 @@ package model
import "time"
type SubmissionStatus int32
type SubmissionStatus uint32
const (
// Phase: Creation
@ -26,7 +26,7 @@ const (
)
type Submission struct {
ID int64 `gorm:"primaryKey"`
ID uint64 `gorm:"primaryKey"`
DisplayName string
Creator string
GameID uint32