mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
* fix: default user from init en .env variables * fix: .env.example --------- Co-authored-by: charles-gauthereau <charles.gauthereau@soluce-technologies.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import {PageParams} from "@/types/next";
|
|
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
|
import {db} from "@/db";
|
|
import {desc, isNull} from "drizzle-orm";
|
|
import {AdminUserList} from "@/components/wrappers/dashboard/admin/users/admin-user-list";
|
|
import {AdminUserAddModal} from "@/components/wrappers/dashboard/admin/users/admin-user-add-modal";
|
|
import {SUPPORTED_PROVIDERS} from "@/lib/auth/config";
|
|
|
|
export default async function RoutePage(props: PageParams<{}>) {
|
|
|
|
const users = await db.query.user.findMany({
|
|
where: (fields) => isNull(fields.deletedAt),
|
|
with: {
|
|
accounts: true
|
|
},
|
|
orderBy: (fields) => desc(fields.createdAt),
|
|
|
|
});
|
|
const organizations = await db.query.organization.findMany({
|
|
with: {
|
|
members: true,
|
|
},
|
|
});
|
|
|
|
const credentialProvider = SUPPORTED_PROVIDERS.find(p => p.id === 'credential');
|
|
const isPasswordAuthEnabled = credentialProvider?.isActive || false;
|
|
|
|
return (
|
|
<Page>
|
|
<PageHeader className="flex flex-col">
|
|
<div className="flex justify-between">
|
|
<PageTitle className="mb-3">Active users</PageTitle>
|
|
{isPasswordAuthEnabled && (
|
|
<PageActions>
|
|
<AdminUserAddModal organizations={organizations}/>
|
|
</PageActions>
|
|
)}
|
|
</div>
|
|
</PageHeader>
|
|
<PageContent className="flex flex-col gap-5">
|
|
<AdminUserList users={users} isPasswordAuthEnabled={isPasswordAuthEnabled}/>
|
|
</PageContent>
|
|
</Page>
|
|
);
|
|
}
|
|
|
|
|