- Timestamp:
- 12/20/25 04:04:03 (7 months ago)
- Branches:
- main
- Children:
- ee1fa4e
- Parents:
- c4dd17d
- Location:
- pages
- Files:
-
- 2 edited
-
+Layout.telefunc.ts (modified) (3 diffs)
-
dashboard/admin/adminDashboard.telefunc.ts (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pages/+Layout.telefunc.ts
rc4dd17d r5ce5904 4 4 5 5 export async function getAuthenticationState() { 6 const c = getAuthState();6 const context = getAuthState(); 7 7 8 return c ;8 return context; 9 9 } 10 10 11 export async function getPopupAllComponents({ componentType, q, limit}12 : { componentType?: string; q?: string; limit?: number}) {11 export async function getPopupAllComponents({ componentType, limit, q } 12 : { componentType?: string; limit?: number; q?: string }) { 13 13 const c = ctx(); 14 14 15 // getAllComponents 15 const components = await drizzleQueries.getAllComponents(c.db, limit, q, componentType); 16 17 return components; 18 } 19 20 export async function getPopupComponentDetails({ componentId } 21 : { componentId: number }) { 22 const context = ctx(); 23 24 if(!Number.isInteger(componentId) || componentId <= 0) throw Abort(); 25 26 const componentDetails = await drizzleQueries.getComponentDetails(context.db, componentId); 27 28 if(!componentDetails) throw Abort(); 29 30 return componentDetails; 31 } 32 33 export async function getPopupSuggestComponent({ link, description, componentType } 34 : { link: string; description: string; componentType: string }) { 35 const { c, userId } = requireUser() 36 37 const newSuggestionId = await drizzleQueries.addComponentSuggestion(c.db, userId, link, description, componentType); 38 39 if(!newSuggestionId) throw Abort(); 40 41 return newSuggestionId; 16 42 } 17 43 … … 38 64 export async function getPopupBuildDetails({ buildId } 39 65 : { buildId: number }) { 40 const context = ctx();66 const context = getAuthState(); 41 67 42 68 if(!Number.isInteger(buildId) || buildId <= 0) throw Abort(); 43 69 44 const buildDetails = await drizzleQueries.getBuildDetails(context.db, buildId );70 const buildDetails = await drizzleQueries.getBuildDetails(context.db, buildId, context.userId ?? undefined); 45 71 46 72 if(!buildDetails) throw Abort(); … … 65 91 66 92 if (!Number.isInteger(buildId) || buildId <= 0) throw Abort(); 93 94 if (!Number.isInteger(value) || value < 1 || value > 5) throw Abort(); 67 95 68 96 const result = await drizzleQueries.setBuildRating(c.db, userId, buildId, value); -
pages/dashboard/admin/adminDashboard.telefunc.ts
rc4dd17d r5ce5904 12 12 const pendingBuilds = await drizzleQueries.getPendingBuilds(c.db); 13 13 const userBuilds = await drizzleQueries.getUserBuilds(c.db, userId); 14 //const componentSuggestions = await drizzleQueries.getComponentSuggestions(c.db);14 const componentSuggestions = await drizzleQueries.getComponentSuggestions(c.db); 15 15 16 16 return { … … 18 18 pendingBuilds, 19 19 userBuilds, 20 //componentSuggestions20 componentSuggestions 21 21 }; 22 22 } … … 40 40 41 41 42 // setComponentSuggestionStatus 42 if(!Number.isInteger(suggestionId) || suggestionId <= 0) throw Abort(); 43 44 const result = await drizzleQueries.setComponentSuggestionStatus(c.db, suggestionId, userId, status, adminComment); 45 46 if (!result) throw Abort(); 47 48 return { success: true }; 43 49 }
Note:
See TracChangeset
for help on using the changeset viewer.
