source: pages/index/buildCards.telefunc.ts@ 67dfe57

main
Last change on this file since 67dfe57 was 40ac7a9, checked in by Mihail <mihail2.naumov@…>, 7 months ago

Added frontend elements

  • Property mode set to 100644
File size: 798 bytes
RevLine 
[40ac7a9]1import {ctx, requireUser} from "../../server/telefunc/ctx";
2import * as drizzleQueries from "../../database/drizzle/queries";
3import {Abort} from "telefunc";
4
5export async function onGetHighestRankedBuilds({ limit }
6 : { limit?: number }) {
7 const context = ctx();
8
9 const highestRankedBuilds = await drizzleQueries.getHighestRankedBuilds(context.db, limit);
10
11 return highestRankedBuilds;
12}
13
14export async function onCloneBuild({ buildId }
15 : { buildId: number }) {
16 const { c, userId } = requireUser()
17
18 if (!Number.isInteger(buildId) || buildId <= 0) throw Abort();
19
20 const newBuild = await drizzleQueries.cloneBuild(c.db, userId, buildId);
21
22 if (!newBuild) throw Abort();
23
24 return newBuild;
25}
Note: See TracBrowser for help on using the repository browser.