Skip to content

Commit 7c5eba8

Browse files
committed
make gen impl
1 parent c012da0 commit 7c5eba8

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3452,7 +3452,8 @@ func (q *querier) GetWorkspacesEligibleForTransition(ctx context.Context, now ti
34523452
}
34533453

34543454
func (q *querier) HasTemplateVersionsWithAITask(ctx context.Context) (bool, error) {
3455-
panic("not implemented")
3455+
// Anyone can call HasTemplateVersionsWithAITask.
3456+
return q.db.HasTemplateVersionsWithAITask(ctx)
34563457
}
34573458

34583459
func (q *querier) InsertAPIKey(ctx context.Context, arg database.InsertAPIKeyParams) (database.APIKey, error) {

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4566,6 +4566,9 @@ func (s *MethodTestSuite) TestSystemFunctions() {
45664566
s.Run("GetProvisionerJobByIDForUpdate", s.Subtest(func(db database.Store, check *expects) {
45674567
check.Args(uuid.New()).Asserts(rbac.ResourceProvisionerJobs, policy.ActionRead).Errors(sql.ErrNoRows)
45684568
}))
4569+
s.Run("HasTemplateVersionsWithAITask", s.Subtest(func(db database.Store, check *expects) {
4570+
check.Args().Asserts()
4571+
}))
45694572
}
45704573

45714574
func (s *MethodTestSuite) TestNotifications() {

coderd/database/dbmem/dbmem.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8491,8 +8491,17 @@ func (q *FakeQuerier) GetWorkspacesEligibleForTransition(ctx context.Context, no
84918491
return workspaces, nil
84928492
}
84938493

8494-
func (q *FakeQuerier) HasTemplateVersionsWithAITask(ctx context.Context) (bool, error) {
8495-
panic("not implemented")
8494+
func (q *FakeQuerier) HasTemplateVersionsWithAITask(_ context.Context) (bool, error) {
8495+
q.mutex.RLock()
8496+
defer q.mutex.RUnlock()
8497+
8498+
for _, templateVersion := range q.templateVersions {
8499+
if templateVersion.HasAITask {
8500+
return true, nil
8501+
}
8502+
}
8503+
8504+
return false, nil
84968505
}
84978506

84988507
func (q *FakeQuerier) InsertAPIKey(_ context.Context, arg database.InsertAPIKeyParams) (database.APIKey, error) {

0 commit comments

Comments
 (0)