mirror of
https://github.com/Mintplex-Labs/vector-admin.git
synced 2026-07-18 18:14:31 -04:00
Fix relationship issue
This commit is contained in:
@@ -97,7 +97,7 @@ function organizationEndpoints(app) {
|
||||
response.sendStatus(403).end();
|
||||
return;
|
||||
}
|
||||
const organizations = await Organization.where({ id: { not: null } });
|
||||
const organizations = await Organization.where({});
|
||||
response.status(200).json({ organizations, error: null });
|
||||
} catch (e) {
|
||||
console.log(e.message, e);
|
||||
|
||||
@@ -87,14 +87,13 @@ const Organization = {
|
||||
|
||||
getWithOwner: async function (userId, clause = {}) {
|
||||
try {
|
||||
const orgIds = (
|
||||
await OrganizationUser.where({ user_id: Number(userId) })
|
||||
).map((record) => record.organization_id);
|
||||
const result = await prisma.organizations.findFirst({
|
||||
where: {
|
||||
...clause,
|
||||
organization_users: {
|
||||
every: {
|
||||
user_id: Number(userId),
|
||||
},
|
||||
},
|
||||
id: { in: orgIds },
|
||||
},
|
||||
});
|
||||
return result;
|
||||
@@ -135,14 +134,13 @@ const Organization = {
|
||||
orderBy = null
|
||||
) {
|
||||
try {
|
||||
const orgIds = (
|
||||
await OrganizationUser.where({ user_id: Number(userId) })
|
||||
).map((record) => record.organization_id);
|
||||
const results = await prisma.organizations.findMany({
|
||||
where: {
|
||||
id: { in: orgIds },
|
||||
...clause,
|
||||
organization_users: {
|
||||
every: {
|
||||
user_id: Number(userId),
|
||||
},
|
||||
},
|
||||
},
|
||||
...(limit ? { take: limit } : {}),
|
||||
...(orderBy ? { orderBy } : {}),
|
||||
|
||||
@@ -329,7 +329,7 @@ export default function Sidebar({
|
||||
to={paths.organizationSettings(organization)}
|
||||
className={`group relative flex items-center gap-2.5 rounded-sm px-4 py-2 font-medium text-bodydark1 duration-300 ease-in-out hover:bg-graydark dark:hover:bg-meta-4 ${
|
||||
(pathname === '/' ||
|
||||
pathname.includes('users')) &&
|
||||
pathname.includes('settings')) &&
|
||||
'bg-graydark dark:bg-meta-4'
|
||||
}`}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user