Unquatification

This commit is contained in:
itzaname 2024-12-12 17:29:20 -05:00
parent 3c0028f308
commit fdc1f1aadf
13 changed files with 207 additions and 194 deletions

View File

@ -2,16 +2,16 @@ package cmds
import (
"fmt"
"git.itzana.me/strafesnet/go-grpc/auth"
"git.itzana.me/strafesnet/maps-service/pkg/api"
"git.itzana.me/strafesnet/maps-service/pkg/datastore/gormstore"
"git.itzana.me/strafesnet/maps-service/pkg/service"
"github.com/nats-io/nats.go"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
"net/http"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"git.itzana.me/strafesnet/go-grpc/auth"
"github.com/nats-io/nats.go"
"net/http"
)
func NewServeCommand() *cli.Command {

View File

@ -46,6 +46,7 @@ func (svc *Service) CreateScriptPolicy(ctx context.Context, req *api.ScriptPolic
ID: script.ID,
}, nil
}
// DeleteScriptPolicy implements deleteScriptPolicy operation.
//
// Delete the specified script policy by ID.
@ -63,6 +64,7 @@ func (svc *Service) DeleteScriptPolicy(ctx context.Context, params api.DeleteScr
return svc.DB.ScriptPolicy().Delete(ctx, params.ScriptPolicyID)
}
// GetScriptPolicy implements getScriptPolicy operation.
//
// Get the specified script policy by ID.
@ -88,6 +90,7 @@ func (svc *Service) GetScriptPolicy(ctx context.Context, params api.GetScriptPol
Policy: int32(policy.Policy),
}, nil
}
// GetScriptPolicyFromHash implements getScriptPolicyFromHash operation.
//
// Get the policy for the given hash of script source code.
@ -119,6 +122,7 @@ func (svc *Service) GetScriptPolicyFromHash(ctx context.Context, params api.GetS
Policy: int32(policy.Policy),
}, nil
}
// UpdateScriptPolicy implements updateScriptPolicy operation.
//
// Update the specified script policy by ID.

View File

@ -39,6 +39,7 @@ func (svc *Service) CreateScript(ctx context.Context, req *api.ScriptCreate) (*a
ID: script.ID,
}, nil
}
// DeleteScript implements deleteScript operation.
//
// Delete the specified script by ID.
@ -56,6 +57,7 @@ func (svc *Service) DeleteScript(ctx context.Context, params api.DeleteScriptPar
return svc.DB.Scripts().Delete(ctx, params.ScriptID)
}
// GetScript implements getScript operation.
//
// Get the specified script by ID.
@ -81,6 +83,7 @@ func (svc *Service) GetScript(ctx context.Context, params api.GetScriptParams) (
SubmissionID: script.SubmissionID,
}, nil
}
// UpdateScript implements updateScript operation.
//
// Update the specified script by ID.

View File

@ -1,10 +1,10 @@
package service
import (
"errors"
"context"
"git.itzana.me/strafesnet/maps-service/pkg/api"
"errors"
"git.itzana.me/strafesnet/go-grpc/auth"
"git.itzana.me/strafesnet/maps-service/pkg/api"
)
var (

View File

@ -9,7 +9,6 @@ import (
"git.itzana.me/strafesnet/maps-service/pkg/model"
)
// POST /submissions
func (svc *Service) CreateSubmission(ctx context.Context, request *api.SubmissionCreate) (*api.ID, error) {
userInfo, ok := ctx.Value("UserInfo").(UserInfo)
@ -172,6 +171,7 @@ func (svc *Service) ActionSubmissionPublish(ctx context.Context, params api.Acti
smap.Add("status_id", model.StatusPublished)
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusPublishing}, smap)
}
// ActionSubmissionReject invokes actionSubmissionReject operation.
//
// Role Reviewer changes status from Submitted -> Rejected.
@ -193,6 +193,7 @@ func (svc *Service) ActionSubmissionReject(ctx context.Context, params api.Actio
smap.Add("status_id", model.StatusRejected)
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusSubmitted}, smap)
}
// ActionSubmissionRequestChanges invokes actionSubmissionRequestChanges operation.
//
// Role Reviewer changes status from Validated|Accepted|Submitted -> ChangesRequested.
@ -214,6 +215,7 @@ func (svc *Service) ActionSubmissionRequestChanges(ctx context.Context, params a
smap.Add("status_id", model.StatusChangesRequested)
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusValidated, model.StatusAccepted, model.StatusSubmitted}, smap)
}
// ActionSubmissionRevoke invokes actionSubmissionRevoke operation.
//
// Role Submitter changes status from Submitted|ChangesRequested -> UnderConstruction.
@ -241,6 +243,7 @@ func (svc *Service) ActionSubmissionRevoke(ctx context.Context, params api.Actio
smap.Add("status_id", model.StatusUnderConstruction)
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusSubmitted, model.StatusChangesRequested}, smap)
}
// ActionSubmissionSubmit invokes actionSubmissionSubmit operation.
//
// Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted.
@ -268,6 +271,7 @@ func (svc *Service) ActionSubmissionSubmit(ctx context.Context, params api.Actio
smap.Add("status_id", model.StatusSubmitted)
return svc.DB.Submissions().IfStatusThenUpdate(ctx, params.SubmissionID, []model.Status{model.StatusUnderConstruction, model.StatusChangesRequested}, smap)
}
// ActionSubmissionTriggerPublish invokes actionSubmissionTriggerPublish operation.
//
// Role Admin changes status from Validated -> Publishing.
@ -329,6 +333,7 @@ func (svc *Service) ActionSubmissionTriggerPublish(ctx context.Context, params a
return nil
}
// ActionSubmissionTriggerValidate invokes actionSubmissionTriggerValidate operation.
//
// Role Reviewer triggers validation and changes status from Submitted|Accepted -> Validating.
@ -369,6 +374,7 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
return nil
}
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
//
// Role Validator changes status from Validating -> Validated.