@@ -7,12 +7,7 @@ import {
77 MOCK_DEFAULT_TEMPLATES_DATA ,
88 MOCK_TEMPLATES_DATA ,
99} from '@/configs/mock-data'
10- import type {
11- DefaultTemplate ,
12- ListTeamTemplatesOptions ,
13- ListTeamTemplatesResult ,
14- Template ,
15- } from '@/core/modules/templates/models'
10+ import type { DefaultTemplate , Template } from '@/core/modules/templates/models'
1611import {
1712 type AuthUserEmailResolver ,
1813 getAuthUserEmailsById ,
@@ -35,9 +30,6 @@ type TemplatesRepositoryDeps = {
3530
3631export interface TeamTemplatesRepository {
3732 getTeamTemplates ( ) : Promise < RepoResult < { templates : Template [ ] } > >
38- listTeamTemplates (
39- options : ListTeamTemplatesOptions
40- ) : Promise < RepoResult < ListTeamTemplatesResult > >
4133 deleteTemplate ( templateId : string ) : Promise < RepoResult < { success : true } > >
4234 updateTemplateVisibility (
4335 templateId : string ,
@@ -95,62 +87,6 @@ export function createTemplatesRepository(
9587 ) ,
9688 } )
9789 } ,
98- async listTeamTemplates ( options ) {
99- if ( USE_MOCK_DATA ) {
100- return ok ( { data : MOCK_TEMPLATES_DATA , nextCursor : null } )
101- }
102-
103- const res = await deps . apiClient . GET ( '/templates' , {
104- params : {
105- query : options ,
106- } ,
107- headers : {
108- ...deps . authHeaders ( scope . accessToken , scope . teamId ) ,
109- } ,
110- } )
111-
112- if ( ! res . response . ok || res . error ) {
113- return err (
114- repoErrorFromHttp (
115- res . response . status ,
116- res . error ?. message ?? 'Failed to fetch templates' ,
117- res . error
118- )
119- )
120- }
121-
122- if ( ! res . data ?. data ?. length ) {
123- return ok ( { data : [ ] , nextCursor : res . data ?. nextCursor ?? null } )
124- }
125-
126- const data = res . data . data . map ( ( t ) : Template | DefaultTemplate => ( {
127- templateID : t . templateID ,
128- buildID : t . buildID ,
129- cpuCount : t . cpuCount ,
130- memoryMB : t . memoryMB ,
131- diskSizeMB : t . diskSizeMB ?? 0 ,
132- public : t . public ,
133- aliases : t . aliases ,
134- names : t . names ,
135- createdAt : t . createdAt ,
136- updatedAt : t . updatedAt ,
137- // Email resolution is deferred while the Supabase auth migration is
138- // in progress; the endpoint returns only the creator id for now.
139- createdBy : t . createdBy
140- ? { id : t . createdBy . id , email : t . createdBy . email ?? '' }
141- : null ,
142- lastSpawnedAt : t . lastSpawnedAt ?? null ,
143- spawnCount : t . spawnCount ,
144- buildCount : t . buildCount ,
145- envdVersion : t . envdVersion ?? '' ,
146- ...( t . isDefault && {
147- isDefault : true as const ,
148- defaultDescription : t . defaultDescription ?? undefined ,
149- } ) ,
150- } ) )
151-
152- return ok ( { data, nextCursor : res . data . nextCursor ?? null } )
153- } ,
15490 async deleteTemplate ( templateId ) {
15591 const res = await deps . infraClient . DELETE ( '/templates/{templateID}' , {
15692 params : {
0 commit comments