Revert "submissions: add AcceptedBy, UploadedBy fields to model"
This reverts commit 4c17a3c9e966c5af5c0da2001f0a59c39edac87d.
This commit is contained in:
parent
92226e768d
commit
88c3866654
pkg
@ -40,10 +40,6 @@ type Submission struct {
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Submitter int64 // UserID
|
||||
// Who clicked the Accept button
|
||||
AcceptedBy int64 // UserID
|
||||
// Who clicked the Upload button
|
||||
UploadedBy int64 // UserID
|
||||
AssetID int64
|
||||
AssetVersion int64
|
||||
ValidatedAssetID int64
|
||||
|
@ -396,16 +396,9 @@ func (svc *Service) ActionSubmissionTriggerUpload(ctx context.Context, params ap
|
||||
return ErrPermissionDeniedNeedRoleSubmissionUpload
|
||||
}
|
||||
|
||||
// track who is performing the upload action
|
||||
userId, err := userInfo.GetUserID()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// transaction
|
||||
smap := datastore.Optional()
|
||||
smap.Add("status_id", model.StatusUploading)
|
||||
smap.Add("uploaded_by", userId)
|
||||
submission, err := svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.Status{model.StatusValidated}, smap)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -510,13 +503,12 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
||||
return err
|
||||
}
|
||||
|
||||
// track who is performing the accept action
|
||||
userId, err := userInfo.GetUserID()
|
||||
has_role, err = userInfo.IsSubmitter(uint64(submission.Submitter))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// check if caller is NOT the submitter
|
||||
if userId == uint64(submission.Submitter) {
|
||||
if has_role {
|
||||
return ErrAcceptOwnSubmission
|
||||
}
|
||||
|
||||
@ -540,7 +532,6 @@ func (svc *Service) ActionSubmissionTriggerValidate(ctx context.Context, params
|
||||
// transaction
|
||||
smap := datastore.Optional()
|
||||
smap.Add("status_id", model.StatusValidating)
|
||||
smap.Add("accepted_by", userId)
|
||||
submission, err = svc.DB.Submissions().IfStatusThenUpdateAndGet(ctx, params.SubmissionID, []model.Status{model.StatusSubmitted}, smap)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user