/api/client/[id]/key, /api/mek/share Endpoint 추가

This commit is contained in:
static
2024-12-31 17:41:54 +09:00
parent 0d00e2476a
commit ccad4fbd8b
8 changed files with 187 additions and 57 deletions

View File

@@ -62,6 +62,16 @@ export const getUserClient = async (userId: number, clientId: number) => {
return userClients[0] ?? null;
};
export const getUserClientWithDetails = async (userId: number, clientId: number) => {
const userClients = await db
.select()
.from(userClient)
.innerJoin(client, eq(userClient.clientId, client.id))
.where(and(eq(userClient.userId, userId), eq(userClient.clientId, clientId)))
.execute();
return userClients[0] ?? null;
};
export const setUserClientStateToPending = async (userId: number, clientId: number) => {
await db
.update(userClient)