main
|
Last change
on this file since 0d447f6 was b69759d, checked in by Tome <gjorgievtome@…>, 7 months ago |
|
add telefunctions
|
-
Property mode
set to
100644
|
|
File size:
551 bytes
|
| Line | |
|---|
| 1 | import * as drizzleQueries from "../../../database/drizzle/queries";
|
|---|
| 2 | import {requireUser} from "../../../server/telefunc/ctx";
|
|---|
| 3 |
|
|---|
| 4 | export async function getUserInfoAndData() {
|
|---|
| 5 | const { c, userId } = requireUser()
|
|---|
| 6 |
|
|---|
| 7 | const user = await drizzleQueries.getUserProfile(c.db, userId);
|
|---|
| 8 |
|
|---|
| 9 | if (!user) throw new Error();
|
|---|
| 10 |
|
|---|
| 11 | const userBuilds = await drizzleQueries.getUserBuilds(c.db, userId);
|
|---|
| 12 | const favoriteBuilds = await drizzleQueries.getFavoriteBuilds(c.db, userId);
|
|---|
| 13 |
|
|---|
| 14 | return {
|
|---|
| 15 | user,
|
|---|
| 16 | userBuilds,
|
|---|
| 17 | favoriteBuilds
|
|---|
| 18 | };
|
|---|
| 19 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.