From fe3562325f87ee6202271e08ee79f70a28146f93 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 9 Dec 2024 21:19:38 -0800 Subject: [PATCH] fix user info --- pkg/service/script_policy.go | 10 +++++----- pkg/service/scripts.go | 8 ++++---- pkg/service/submissions.go | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pkg/service/script_policy.go b/pkg/service/script_policy.go index 228ee2a..0908aae 100644 --- a/pkg/service/script_policy.go +++ b/pkg/service/script_policy.go @@ -16,7 +16,7 @@ import ( // // POST /script-policy func (svc *Service) CreateScriptPolicy(ctx context.Context, req *api.ScriptPolicyCreate) (*api.ID, error){ - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return nil, ErrUserInfo } @@ -52,7 +52,7 @@ func (svc *Service) CreateScriptPolicy(ctx context.Context, req *api.ScriptPolic // // DELETE /script-policy/id/{ScriptPolicyID} func (svc *Service) DeleteScriptPolicy(ctx context.Context, params api.DeleteScriptPolicyParams) error{ - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -69,7 +69,7 @@ func (svc *Service) DeleteScriptPolicy(ctx context.Context, params api.DeleteScr // // GET /script-policy/id/{ScriptPolicyID} func (svc *Service) GetScriptPolicy(ctx context.Context, params api.GetScriptPolicyParams) (*api.ScriptPolicy, error){ - _, ok := ctx.Value("UserInfo").(*UserInfo) + _, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return nil, ErrUserInfo } @@ -94,7 +94,7 @@ func (svc *Service) GetScriptPolicy(ctx context.Context, params api.GetScriptPol // // GET /script-policy/hash/{FromScriptHash} func (svc *Service) GetScriptPolicyFromHash(ctx context.Context, params api.GetScriptPolicyFromHashParams) (*api.ScriptPolicy, error){ - _, ok := ctx.Value("UserInfo").(*UserInfo) + _, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return nil, ErrUserInfo } @@ -125,7 +125,7 @@ func (svc *Service) GetScriptPolicyFromHash(ctx context.Context, params api.GetS // // PATCH /script-policy/id/{ScriptPolicyID} func (svc *Service) UpdateScriptPolicy(ctx context.Context, req *api.ScriptPolicyUpdate, params api.UpdateScriptPolicyParams) error{ - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } diff --git a/pkg/service/scripts.go b/pkg/service/scripts.go index 4bd08e4..7877219 100644 --- a/pkg/service/scripts.go +++ b/pkg/service/scripts.go @@ -16,7 +16,7 @@ import ( // // POST /scripts func (svc *Service) CreateScript(ctx context.Context, req *api.ScriptCreate) (*api.ID, error){ - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return nil, ErrUserInfo } @@ -45,7 +45,7 @@ func (svc *Service) CreateScript(ctx context.Context, req *api.ScriptCreate) (*a // // DELETE /scripts/{ScriptID} func (svc *Service) DeleteScript(ctx context.Context, params api.DeleteScriptParams) error{ - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -62,7 +62,7 @@ func (svc *Service) DeleteScript(ctx context.Context, params api.DeleteScriptPar // // GET /scripts/{ScriptID} func (svc *Service) GetScript(ctx context.Context, params api.GetScriptParams) (*api.Script, error){ - _, ok := ctx.Value("UserInfo").(*UserInfo) + _, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return nil, ErrUserInfo } @@ -87,7 +87,7 @@ func (svc *Service) GetScript(ctx context.Context, params api.GetScriptParams) ( // // PATCH /scripts/{ScriptID} func (svc *Service) UpdateScript(ctx context.Context, req *api.ScriptUpdate, params api.UpdateScriptParams) error{ - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } diff --git a/pkg/service/submissions.go b/pkg/service/submissions.go index 6c1b82e..7ffc0a2 100644 --- a/pkg/service/submissions.go +++ b/pkg/service/submissions.go @@ -16,7 +16,7 @@ var ( // POST /submissions func (svc *Service) CreateSubmission(ctx context.Context, request *api.SubmissionCreate) (*api.ID, error) { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return nil, ErrUserInfo } @@ -115,7 +115,7 @@ func (svc *Service) ListSubmissions(ctx context.Context, request api.ListSubmiss // // PATCH /submissions/{SubmissionID}/completed func (svc *Service) PatchSubmissionCompleted(ctx context.Context, params api.PatchSubmissionCompletedParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -137,7 +137,7 @@ func (svc *Service) PatchSubmissionCompleted(ctx context.Context, params api.Pat // // PATCH /submissions/{SubmissionID}/model func (svc *Service) PatchSubmissionModel(ctx context.Context, params api.PatchSubmissionModelParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -168,7 +168,7 @@ func (svc *Service) PatchSubmissionModel(ctx context.Context, params api.PatchSu // // PATCH /submissions/{SubmissionID}/status/publish func (svc *Service) ActionSubmissionPublish(ctx context.Context, params api.ActionSubmissionPublishParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -189,7 +189,7 @@ func (svc *Service) ActionSubmissionPublish(ctx context.Context, params api.Acti // // PATCH /submissions/{SubmissionID}/status/reject func (svc *Service) ActionSubmissionReject(ctx context.Context, params api.ActionSubmissionRejectParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -210,7 +210,7 @@ func (svc *Service) ActionSubmissionReject(ctx context.Context, params api.Actio // // PATCH /submissions/{SubmissionID}/status/request-changes func (svc *Service) ActionSubmissionRequestChanges(ctx context.Context, params api.ActionSubmissionRequestChangesParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -231,7 +231,7 @@ func (svc *Service) ActionSubmissionRequestChanges(ctx context.Context, params a // // PATCH /submissions/{SubmissionID}/status/revoke func (svc *Service) ActionSubmissionRevoke(ctx context.Context, params api.ActionSubmissionRevokeParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -258,7 +258,7 @@ func (svc *Service) ActionSubmissionRevoke(ctx context.Context, params api.Actio // // PATCH /submissions/{SubmissionID}/status/submit func (svc *Service) ActionSubmissionSubmit(ctx context.Context, params api.ActionSubmissionSubmitParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -285,7 +285,7 @@ func (svc *Service) ActionSubmissionSubmit(ctx context.Context, params api.Actio // // PATCH /submissions/{SubmissionID}/status/trigger-publish func (svc *Service) ActionSubmissionTriggerPublish(ctx context.Context, params api.ActionSubmissionTriggerPublishParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -306,7 +306,7 @@ func (svc *Service) ActionSubmissionTriggerPublish(ctx context.Context, params a // // PATCH /submissions/{SubmissionID}/status/trigger-validate func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params api.ActionSubmissionTriggerValidateParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo } @@ -327,7 +327,7 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params // // PATCH /submissions/{SubmissionID}/status/validate func (svc *Service) ActionSubmissionValidate(ctx context.Context, params api.ActionSubmissionValidateParams) error { - userInfo, ok := ctx.Value("UserInfo").(*UserInfo) + userInfo, ok := ctx.Value("UserInfo").(UserInfo) if !ok{ return ErrUserInfo }