Ignore:
Timestamp:
12/23/25 04:21:42 (7 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
ea09e98
Parents:
ee1fa4e
Message:

Update telefunctions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/+Layout.telefunc.ts

    ree1fa4e r226fbbb  
    22import {ctx, getAuthState, requireUser} from "../server/telefunc/ctx";
    33import {Abort} from "telefunc";
     4import type {Database} from "../database/drizzle/db";
    45
    5 export async function getAuthenticationState() {
     6export async function AuthenticationState() {
    67    const context = getAuthState();
    78
     
    910}
    1011
    11 export async function getPopupAllComponents({ componentType, limit, q }
     12export async function onGetAllComponents({ componentType, limit, q }
    1213                                            : { componentType?: string; limit?: number; q?: string }) {
    1314    const c = ctx();
     
    1819}
    1920
    20 export async function getPopupComponentDetails({ componentId }
     21export async function onGetComponentDetails({ componentId }
    2122                                           : { componentId: number }) {
    2223    const context = ctx();
     
    3132}
    3233
    33 export async function getPopupSuggestComponent({ link, description, componentType }
     34export async function onSuggestComponent({ link, description, componentType }
    3435                                               : { link: string; description: string; componentType: string }) {
    3536    const { c, userId } = requireUser()
    3637
    37     const newSuggestionId = await drizzleQueries.addComponentSuggestion(c.db, userId, link, description, componentType);
     38    const newSuggestionId = await drizzleQueries.addNewComponentSuggestion(c.db, userId, link, description, componentType);
    3839
    3940    if(!newSuggestionId) throw Abort();
     
    4243}
    4344
    44 export async function getPopupAllApprovedBuilds({ limit, q }
     45export async function onGetApprovedBuilds({ limit, q }
    4546                                                 : { limit?: number; q?: string }) {
    4647    const context = ctx();
     
    5152}
    5253
    53 export async function getPopupHighestRankedBuilds({ limit }
     54export async function onGetHighestRankedBuilds({ limit }
    5455                                                  : { limit?: number }) {
    5556    const context = ctx();
     
    6263// Shared
    6364
    64 export async function getPopupBuildDetails({ buildId }
     65export async function onGetBuildDetails({ buildId }
    6566                                           : { buildId: number }) {
    6667    const context = getAuthState();
     
    7576}
    7677
    77 export async function togglePopupFavorite({ buildId }
     78export async function onToggleFavorite({ buildId }
    7879                                          : { buildId: number }) {
    7980    const { c, userId } = requireUser()
     
    8687}
    8788
    88 export async function setPopupRating({ buildId, value }
     89export async function onSetRating({ buildId, value }
    8990                                     : { buildId: number; value: number }) {
    9091    const { c, userId } = requireUser()
     
    99100}
    100101
    101 export async function setPopupReview({ buildId, content }
     102export async function onSetReview({ buildId, content }
    102103                                     : { buildId: number; content: string }) {
    103104    const { c, userId } = requireUser()
     
    110111}
    111112
    112 export async function clonePopupBuild({ buildId }
     113export async function onCloneBuild({ buildId }
    113114                                      : { buildId: number }) {
    114115    const { c, userId } = requireUser()
     
    116117    if (!Number.isInteger(buildId) || buildId <= 0) throw Abort();
    117118
    118     const newBuildId = await drizzleQueries.cloneBuild(c.db, userId, buildId);
     119    const newBuild = await drizzleQueries.cloneBuild(c.db, userId, buildId);
    119120
    120     if (!newBuildId) throw Abort();
     121    if (!newBuild) throw Abort();
    121122
    122     return newBuildId;
     123    return newBuild;
    123124}
     125
     126
     127
     128
     129
     130
Note: See TracChangeset for help on using the changeset viewer.