mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-18 07:58:57 +00:00
/api/mek/register/initial Endpoint 추가
This commit is contained in:
@@ -25,15 +25,6 @@ export const getAllUserClients = async (userId: number) => {
|
||||
return await db.select().from(userClient).where(eq(userClient.userId, userId)).execute();
|
||||
};
|
||||
|
||||
export const countActiveUserClients = async (userId: number) => {
|
||||
const userClients = await db
|
||||
.select({ count: count() })
|
||||
.from(userClient)
|
||||
.where(and(eq(userClient.userId, userId), eq(userClient.state, "active")))
|
||||
.execute();
|
||||
return userClients[0]?.count ?? null;
|
||||
};
|
||||
|
||||
export const getUserClient = async (userId: number, clientId: number) => {
|
||||
const userClients = await db
|
||||
.select()
|
||||
@@ -57,6 +48,20 @@ export const setUserClientStateToPending = async (userId: number, clientId: numb
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const setUserClientStateToActive = async (userId: number, clientId: number) => {
|
||||
await db
|
||||
.update(userClient)
|
||||
.set({ state: "active" })
|
||||
.where(
|
||||
and(
|
||||
eq(userClient.userId, userId),
|
||||
eq(userClient.clientId, clientId),
|
||||
eq(userClient.state, "pending"),
|
||||
),
|
||||
)
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const createUserClientChallenge = async (
|
||||
userId: number,
|
||||
clientId: number,
|
||||
|
||||
Reference in New Issue
Block a user