mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: add organizations system
This commit is contained in:
@@ -94,8 +94,8 @@ export const updateAdminById = async (
|
||||
};
|
||||
|
||||
export const isAdminPresent = async () => {
|
||||
const admin = await db.query.users.findFirst({
|
||||
where: eq(users.role, "admin"),
|
||||
const admin = await db.query.user.findFirst({
|
||||
where: eq(user.role, "admin"),
|
||||
});
|
||||
if (!admin) {
|
||||
return false;
|
||||
|
||||
@@ -100,10 +100,11 @@ export const findAuthByEmail = async (email: string) => {
|
||||
};
|
||||
|
||||
export const findAuthById = async (authId: string) => {
|
||||
const result = await db.query.auth.findFirst({
|
||||
where: eq(auth.id, authId),
|
||||
const result = await db.query.user.findFirst({
|
||||
where: eq(user.id, authId),
|
||||
columns: {
|
||||
password: false,
|
||||
createdAt: false,
|
||||
updatedAt: false,
|
||||
},
|
||||
});
|
||||
if (!result) {
|
||||
|
||||
@@ -20,18 +20,16 @@ export const findUserById = async (userId: string) => {
|
||||
|
||||
export const findUserByAuthId = async (authId: string) => {
|
||||
const userR = await db.query.user.findFirst({
|
||||
where: eq(user.authId, authId),
|
||||
with: {
|
||||
auth: true,
|
||||
},
|
||||
where: eq(user.id, authId),
|
||||
with: {},
|
||||
});
|
||||
if (!user) {
|
||||
if (!userR) {
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
message: "User not found",
|
||||
});
|
||||
}
|
||||
return user;
|
||||
return userR;
|
||||
};
|
||||
|
||||
export const findUsers = async (adminId: string) => {
|
||||
|
||||
Reference in New Issue
Block a user