@@ -4691,9 +4691,9 @@ func (q *querier) UpdateTemplateScheduleByID(ctx context.Context, arg database.U
4691
4691
return update (q .log , q .auth , fetch , q .db .UpdateTemplateScheduleByID )(ctx , arg )
4692
4692
}
4693
4693
4694
- func (q * querier ) UpdateTemplateVersionAITaskByJobID (ctx context.Context , arg database.UpdateTemplateVersionAITaskByJobIDParams ) error {
4695
- // An actor is allowed to update the template version AI task flag if they are authorized to update the template.
4696
- tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4694
+ func (q * querier ) UpdateTemplateVersionByID (ctx context.Context , arg database.UpdateTemplateVersionByIDParams ) error {
4695
+ // An actor is allowed to update the template version if they are authorized to update the template.
4696
+ tv , err := q .db .GetTemplateVersionByID (ctx , arg .ID )
4697
4697
if err != nil {
4698
4698
return err
4699
4699
}
@@ -4710,12 +4710,12 @@ func (q *querier) UpdateTemplateVersionAITaskByJobID(ctx context.Context, arg da
4710
4710
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4711
4711
return err
4712
4712
}
4713
- return q .db .UpdateTemplateVersionAITaskByJobID (ctx , arg )
4713
+ return q .db .UpdateTemplateVersionByID (ctx , arg )
4714
4714
}
4715
4715
4716
- func (q * querier ) UpdateTemplateVersionByID (ctx context.Context , arg database.UpdateTemplateVersionByIDParams ) error {
4717
- // An actor is allowed to update the template version if they are authorized to update the template.
4718
- tv , err := q .db .GetTemplateVersionByID (ctx , arg .ID )
4716
+ func (q * querier ) UpdateTemplateVersionDescriptionByJobID (ctx context.Context , arg database.UpdateTemplateVersionDescriptionByJobIDParams ) error {
4717
+ // An actor is allowed to update the template version description if they are authorized to update the template.
4718
+ tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4719
4719
if err != nil {
4720
4720
return err
4721
4721
}
@@ -4732,11 +4732,11 @@ func (q *querier) UpdateTemplateVersionByID(ctx context.Context, arg database.Up
4732
4732
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4733
4733
return err
4734
4734
}
4735
- return q .db .UpdateTemplateVersionByID (ctx , arg )
4735
+ return q .db .UpdateTemplateVersionDescriptionByJobID (ctx , arg )
4736
4736
}
4737
4737
4738
- func (q * querier ) UpdateTemplateVersionDescriptionByJobID (ctx context.Context , arg database.UpdateTemplateVersionDescriptionByJobIDParams ) error {
4739
- // An actor is allowed to update the template version description if they are authorized to update the template.
4738
+ func (q * querier ) UpdateTemplateVersionExternalAuthProvidersByJobID (ctx context.Context , arg database.UpdateTemplateVersionExternalAuthProvidersByJobIDParams ) error {
4739
+ // An actor is allowed to update the template version external auth providers if they are authorized to update the template.
4740
4740
tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4741
4741
if err != nil {
4742
4742
return err
@@ -4754,11 +4754,11 @@ func (q *querier) UpdateTemplateVersionDescriptionByJobID(ctx context.Context, a
4754
4754
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4755
4755
return err
4756
4756
}
4757
- return q .db .UpdateTemplateVersionDescriptionByJobID (ctx , arg )
4757
+ return q .db .UpdateTemplateVersionExternalAuthProvidersByJobID (ctx , arg )
4758
4758
}
4759
4759
4760
- func (q * querier ) UpdateTemplateVersionExternalAuthProvidersByJobID (ctx context.Context , arg database.UpdateTemplateVersionExternalAuthProvidersByJobIDParams ) error {
4761
- // An actor is allowed to update the template version external auth providers if they are authorized to update the template.
4760
+ func (q * querier ) UpdateTemplateVersionFlagsByJobID (ctx context.Context , arg database.UpdateTemplateVersionFlagsByJobIDParams ) error {
4761
+ // An actor is allowed to update the template version ai task and external agent flag if they are authorized to update the template.
4762
4762
tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4763
4763
if err != nil {
4764
4764
return err
@@ -4776,7 +4776,7 @@ func (q *querier) UpdateTemplateVersionExternalAuthProvidersByJobID(ctx context.
4776
4776
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4777
4777
return err
4778
4778
}
4779
- return q .db .UpdateTemplateVersionExternalAuthProvidersByJobID (ctx , arg )
4779
+ return q .db .UpdateTemplateVersionFlagsByJobID (ctx , arg )
4780
4780
}
4781
4781
4782
4782
func (q * querier ) UpdateTemplateWorkspacesLastUsedAt (ctx context.Context , arg database.UpdateTemplateWorkspacesLastUsedAtParams ) error {
@@ -5094,7 +5094,15 @@ func (q *querier) UpdateWorkspaceAutostart(ctx context.Context, arg database.Upd
5094
5094
return update (q .log , q .auth , fetch , q .db .UpdateWorkspaceAutostart )(ctx , arg )
5095
5095
}
5096
5096
5097
- func (q * querier ) UpdateWorkspaceBuildAITaskByID (ctx context.Context , arg database.UpdateWorkspaceBuildAITaskByIDParams ) error {
5097
+ // UpdateWorkspaceBuildCostByID is used by the provisioning system to update the cost of a workspace build.
5098
+ func (q * querier ) UpdateWorkspaceBuildCostByID (ctx context.Context , arg database.UpdateWorkspaceBuildCostByIDParams ) error {
5099
+ if err := q .authorizeContext (ctx , policy .ActionUpdate , rbac .ResourceSystem ); err != nil {
5100
+ return err
5101
+ }
5102
+ return q .db .UpdateWorkspaceBuildCostByID (ctx , arg )
5103
+ }
5104
+
5105
+ func (q * querier ) UpdateWorkspaceBuildDeadlineByID (ctx context.Context , arg database.UpdateWorkspaceBuildDeadlineByIDParams ) error {
5098
5106
build , err := q .db .GetWorkspaceBuildByID (ctx , arg .ID )
5099
5107
if err != nil {
5100
5108
return err
@@ -5109,18 +5117,10 @@ func (q *querier) UpdateWorkspaceBuildAITaskByID(ctx context.Context, arg databa
5109
5117
if err != nil {
5110
5118
return err
5111
5119
}
5112
- return q .db .UpdateWorkspaceBuildAITaskByID (ctx , arg )
5113
- }
5114
-
5115
- // UpdateWorkspaceBuildCostByID is used by the provisioning system to update the cost of a workspace build.
5116
- func (q * querier ) UpdateWorkspaceBuildCostByID (ctx context.Context , arg database.UpdateWorkspaceBuildCostByIDParams ) error {
5117
- if err := q .authorizeContext (ctx , policy .ActionUpdate , rbac .ResourceSystem ); err != nil {
5118
- return err
5119
- }
5120
- return q .db .UpdateWorkspaceBuildCostByID (ctx , arg )
5120
+ return q .db .UpdateWorkspaceBuildDeadlineByID (ctx , arg )
5121
5121
}
5122
5122
5123
- func (q * querier ) UpdateWorkspaceBuildDeadlineByID (ctx context.Context , arg database.UpdateWorkspaceBuildDeadlineByIDParams ) error {
5123
+ func (q * querier ) UpdateWorkspaceBuildFlagsByID (ctx context.Context , arg database.UpdateWorkspaceBuildFlagsByIDParams ) error {
5124
5124
build , err := q .db .GetWorkspaceBuildByID (ctx , arg .ID )
5125
5125
if err != nil {
5126
5126
return err
@@ -5135,7 +5135,7 @@ func (q *querier) UpdateWorkspaceBuildDeadlineByID(ctx context.Context, arg data
5135
5135
if err != nil {
5136
5136
return err
5137
5137
}
5138
- return q .db .UpdateWorkspaceBuildDeadlineByID (ctx , arg )
5138
+ return q .db .UpdateWorkspaceBuildFlagsByID (ctx , arg )
5139
5139
}
5140
5140
5141
5141
func (q * querier ) UpdateWorkspaceBuildProvisionerStateByID (ctx context.Context , arg database.UpdateWorkspaceBuildProvisionerStateByIDParams ) error {
0 commit comments