@@ -4733,9 +4733,9 @@ func (q *querier) UpdateTemplateScheduleByID(ctx context.Context, arg database.U
4733
4733
return update (q .log , q .auth , fetch , q .db .UpdateTemplateScheduleByID )(ctx , arg )
4734
4734
}
4735
4735
4736
- func (q * querier ) UpdateTemplateVersionAITaskByJobID (ctx context.Context , arg database.UpdateTemplateVersionAITaskByJobIDParams ) error {
4737
- // An actor is allowed to update the template version AI task flag if they are authorized to update the template.
4738
- tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4736
+ func (q * querier ) UpdateTemplateVersionByID (ctx context.Context , arg database.UpdateTemplateVersionByIDParams ) error {
4737
+ // An actor is allowed to update the template version if they are authorized to update the template.
4738
+ tv , err := q .db .GetTemplateVersionByID (ctx , arg .ID )
4739
4739
if err != nil {
4740
4740
return err
4741
4741
}
@@ -4752,12 +4752,12 @@ func (q *querier) UpdateTemplateVersionAITaskByJobID(ctx context.Context, arg da
4752
4752
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4753
4753
return err
4754
4754
}
4755
- return q .db .UpdateTemplateVersionAITaskByJobID (ctx , arg )
4755
+ return q .db .UpdateTemplateVersionByID (ctx , arg )
4756
4756
}
4757
4757
4758
- func (q * querier ) UpdateTemplateVersionByID (ctx context.Context , arg database.UpdateTemplateVersionByIDParams ) error {
4759
- // An actor is allowed to update the template version if they are authorized to update the template.
4760
- tv , err := q .db .GetTemplateVersionByID (ctx , arg .ID )
4758
+ func (q * querier ) UpdateTemplateVersionDescriptionByJobID (ctx context.Context , arg database.UpdateTemplateVersionDescriptionByJobIDParams ) error {
4759
+ // An actor is allowed to update the template version description if they are authorized to update the template.
4760
+ tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4761
4761
if err != nil {
4762
4762
return err
4763
4763
}
@@ -4774,11 +4774,11 @@ func (q *querier) UpdateTemplateVersionByID(ctx context.Context, arg database.Up
4774
4774
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4775
4775
return err
4776
4776
}
4777
- return q .db .UpdateTemplateVersionByID (ctx , arg )
4777
+ return q .db .UpdateTemplateVersionDescriptionByJobID (ctx , arg )
4778
4778
}
4779
4779
4780
- func (q * querier ) UpdateTemplateVersionDescriptionByJobID (ctx context.Context , arg database.UpdateTemplateVersionDescriptionByJobIDParams ) error {
4781
- // An actor is allowed to update the template version description if they are authorized to update the template.
4780
+ func (q * querier ) UpdateTemplateVersionExternalAuthProvidersByJobID (ctx context.Context , arg database.UpdateTemplateVersionExternalAuthProvidersByJobIDParams ) error {
4781
+ // An actor is allowed to update the template version external auth providers if they are authorized to update the template.
4782
4782
tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4783
4783
if err != nil {
4784
4784
return err
@@ -4796,11 +4796,11 @@ func (q *querier) UpdateTemplateVersionDescriptionByJobID(ctx context.Context, a
4796
4796
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4797
4797
return err
4798
4798
}
4799
- return q .db .UpdateTemplateVersionDescriptionByJobID (ctx , arg )
4799
+ return q .db .UpdateTemplateVersionExternalAuthProvidersByJobID (ctx , arg )
4800
4800
}
4801
4801
4802
- func (q * querier ) UpdateTemplateVersionExternalAuthProvidersByJobID (ctx context.Context , arg database.UpdateTemplateVersionExternalAuthProvidersByJobIDParams ) error {
4803
- // An actor is allowed to update the template version external auth providers if they are authorized to update the template.
4802
+ func (q * querier ) UpdateTemplateVersionFlagsByJobID (ctx context.Context , arg database.UpdateTemplateVersionFlagsByJobIDParams ) error {
4803
+ // An actor is allowed to update the template version ai task and external agent flag if they are authorized to update the template.
4804
4804
tv , err := q .db .GetTemplateVersionByJobID (ctx , arg .JobID )
4805
4805
if err != nil {
4806
4806
return err
@@ -4818,7 +4818,7 @@ func (q *querier) UpdateTemplateVersionExternalAuthProvidersByJobID(ctx context.
4818
4818
if err := q .authorizeContext (ctx , policy .ActionUpdate , obj ); err != nil {
4819
4819
return err
4820
4820
}
4821
- return q .db .UpdateTemplateVersionExternalAuthProvidersByJobID (ctx , arg )
4821
+ return q .db .UpdateTemplateVersionFlagsByJobID (ctx , arg )
4822
4822
}
4823
4823
4824
4824
func (q * querier ) UpdateTemplateWorkspacesLastUsedAt (ctx context.Context , arg database.UpdateTemplateWorkspacesLastUsedAtParams ) error {
@@ -5143,7 +5143,15 @@ func (q *querier) UpdateWorkspaceAutostart(ctx context.Context, arg database.Upd
5143
5143
return update (q .log , q .auth , fetch , q .db .UpdateWorkspaceAutostart )(ctx , arg )
5144
5144
}
5145
5145
5146
- func (q * querier ) UpdateWorkspaceBuildAITaskByID (ctx context.Context , arg database.UpdateWorkspaceBuildAITaskByIDParams ) error {
5146
+ // UpdateWorkspaceBuildCostByID is used by the provisioning system to update the cost of a workspace build.
5147
+ func (q * querier ) UpdateWorkspaceBuildCostByID (ctx context.Context , arg database.UpdateWorkspaceBuildCostByIDParams ) error {
5148
+ if err := q .authorizeContext (ctx , policy .ActionUpdate , rbac .ResourceSystem ); err != nil {
5149
+ return err
5150
+ }
5151
+ return q .db .UpdateWorkspaceBuildCostByID (ctx , arg )
5152
+ }
5153
+
5154
+ func (q * querier ) UpdateWorkspaceBuildDeadlineByID (ctx context.Context , arg database.UpdateWorkspaceBuildDeadlineByIDParams ) error {
5147
5155
build , err := q .db .GetWorkspaceBuildByID (ctx , arg .ID )
5148
5156
if err != nil {
5149
5157
return err
@@ -5158,18 +5166,10 @@ func (q *querier) UpdateWorkspaceBuildAITaskByID(ctx context.Context, arg databa
5158
5166
if err != nil {
5159
5167
return err
5160
5168
}
5161
- return q .db .UpdateWorkspaceBuildAITaskByID (ctx , arg )
5162
- }
5163
-
5164
- // UpdateWorkspaceBuildCostByID is used by the provisioning system to update the cost of a workspace build.
5165
- func (q * querier ) UpdateWorkspaceBuildCostByID (ctx context.Context , arg database.UpdateWorkspaceBuildCostByIDParams ) error {
5166
- if err := q .authorizeContext (ctx , policy .ActionUpdate , rbac .ResourceSystem ); err != nil {
5167
- return err
5168
- }
5169
- return q .db .UpdateWorkspaceBuildCostByID (ctx , arg )
5169
+ return q .db .UpdateWorkspaceBuildDeadlineByID (ctx , arg )
5170
5170
}
5171
5171
5172
- func (q * querier ) UpdateWorkspaceBuildDeadlineByID (ctx context.Context , arg database.UpdateWorkspaceBuildDeadlineByIDParams ) error {
5172
+ func (q * querier ) UpdateWorkspaceBuildFlagsByID (ctx context.Context , arg database.UpdateWorkspaceBuildFlagsByIDParams ) error {
5173
5173
build , err := q .db .GetWorkspaceBuildByID (ctx , arg .ID )
5174
5174
if err != nil {
5175
5175
return err
@@ -5184,7 +5184,7 @@ func (q *querier) UpdateWorkspaceBuildDeadlineByID(ctx context.Context, arg data
5184
5184
if err != nil {
5185
5185
return err
5186
5186
}
5187
- return q .db .UpdateWorkspaceBuildDeadlineByID (ctx , arg )
5187
+ return q .db .UpdateWorkspaceBuildFlagsByID (ctx , arg )
5188
5188
}
5189
5189
5190
5190
func (q * querier ) UpdateWorkspaceBuildProvisionerStateByID (ctx context.Context , arg database.UpdateWorkspaceBuildProvisionerStateByIDParams ) error {
0 commit comments