submissions: postgres does not support unsigned integers, so let's pretend they are signed
This commit is contained in:
pkg
model
service
service_internal
@ -26,7 +26,7 @@ func (svc *Service) CreateScript(ctx context.Context, req *api.ScriptCreate) (*a
|
||||
script, err := svc.DB.Scripts().Create(ctx, model.Script{
|
||||
ID: 0,
|
||||
Name: req.Name,
|
||||
Hash: model.HashSource(req.Source),
|
||||
Hash: int64(model.HashSource(req.Source)),
|
||||
Source: req.Source,
|
||||
SubmissionID: req.SubmissionID.Or(0),
|
||||
})
|
||||
@ -52,7 +52,7 @@ func (svc *Service) ListScripts(ctx context.Context, params api.ListScriptsParam
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
filter.AddNotNil("hash", hash)
|
||||
filter.AddNotNil("hash", int64(hash)) // No type safety!
|
||||
}
|
||||
if params.Name.IsSet(){
|
||||
filter.AddNotNil("name", params.Name.Value)
|
||||
@ -76,7 +76,7 @@ func (svc *Service) ListScripts(ctx context.Context, params api.ListScriptsParam
|
||||
for i := 0; i < len(items); i++ {
|
||||
resp = append(resp, api.Script{
|
||||
ID: items[i].ID,
|
||||
Hash: model.HashFormat(items[i].Hash),
|
||||
Hash: model.HashFormat(uint64(items[i].Hash)),
|
||||
Source: items[i].Source,
|
||||
SubmissionID: items[i].SubmissionID,
|
||||
})
|
||||
@ -124,7 +124,7 @@ func (svc *Service) GetScript(ctx context.Context, params api.GetScriptParams) (
|
||||
return &api.Script{
|
||||
ID: script.ID,
|
||||
Name: script.Name,
|
||||
Hash: model.HashFormat(script.Hash),
|
||||
Hash: model.HashFormat(uint64(script.Hash)),
|
||||
Source: script.Source,
|
||||
SubmissionID: script.SubmissionID,
|
||||
}, nil
|
||||
@ -151,7 +151,7 @@ func (svc *Service) UpdateScript(ctx context.Context, req *api.ScriptUpdate, par
|
||||
}
|
||||
if source, ok := req.Source.Get(); ok {
|
||||
pmap.Add("source", source)
|
||||
pmap.Add("hash", model.HashSource(source))
|
||||
pmap.Add("hash", int64(model.HashSource(source))) // No type safety!
|
||||
}
|
||||
if SubmissionID, ok := req.SubmissionID.Get(); ok {
|
||||
pmap.Add("submission_id", SubmissionID)
|
||||
|
Reference in New Issue
Block a user