Acidias
Acidias
Explore posts from servers
PPrisma
Created by Acidias on 2/16/2025 in #help-and-questions
findMany() vs findMany({...})
But I when I change the getUKCounties to get the counties like:
const counties = await prisma.county.findMany({
where: {},
select: {
id: true,
name: true
}
});
const counties = await prisma.county.findMany({
where: {},
select: {
id: true,
name: true
}
});
Its works just fine
6 replies
PPrisma
Created by Acidias on 2/16/2025 in #help-and-questions
findMany() vs findMany({...})
This is where I call the lists.ts
// src/app/api/sign-up-lists/route.ts

import { NextResponse } from 'next/server';
import {
getUKCounties,
getWritingExperienceLevels,
} from '@/lib/db/lists';
import type { County, WritingExperienceLevel } from '@prisma/client';

interface OptionsResponse {
ukCounties?: County[];
writingExperienceLevels?: WritingExperienceLevel[];
error?: string;
}

export async function GET(): Promise<NextResponse<OptionsResponse>> {
try {
const ukCounties = await getUKCounties();
const writingExperienceLevels = await getWritingExperienceLevels();
return NextResponse.json({ ukCounties, writingExperienceLevels });
} catch (error) {
console.error(error);
return NextResponse.json({ error: 'Failed to load data' }, { status: 500 });
}
}
// src/app/api/sign-up-lists/route.ts

import { NextResponse } from 'next/server';
import {
getUKCounties,
getWritingExperienceLevels,
} from '@/lib/db/lists';
import type { County, WritingExperienceLevel } from '@prisma/client';

interface OptionsResponse {
ukCounties?: County[];
writingExperienceLevels?: WritingExperienceLevel[];
error?: string;
}

export async function GET(): Promise<NextResponse<OptionsResponse>> {
try {
const ukCounties = await getUKCounties();
const writingExperienceLevels = await getWritingExperienceLevels();
return NextResponse.json({ ukCounties, writingExperienceLevels });
} catch (error) {
console.error(error);
return NextResponse.json({ error: 'Failed to load data' }, { status: 500 });
}
}
6 replies
PPrisma
Created by Acidias on 2/16/2025 in #help-and-questions
findMany() vs findMany({...})
No errors. Just an empty [] in the db.ts
const counties = await prisma.county.findMany();
console.log("Counties:", counties);
const counties = await prisma.county.findMany();
console.log("Counties:", counties);
log: Counties: [ { id: 1, name: 'test' }, { id: 2, name: 'Test' } ] But in lists.ts
const counties = await prisma.county.findMany();
console.log('FindMany result:', counties);
const counties = await prisma.county.findMany();
console.log('FindMany result:', counties);
log: FindMany result: []
6 replies
RRefine
Created by harsh-harlequin on 5/31/2023 in #ask-any-question
After adding a parent to my menuItem in the sidebar the create: AddEmployee is giving 404 error
This is the return:
Title={Title}
Sider={Sider}
Layout={Layout}
Header={Header}
legacyRouterProvider={routerProvider}
legacyAuthProvider={authProvider}
LoginPage={Login}
DashboardPage={BusinessDetails}
>
<Routes>
<Route
element={
<Layout>
<Outlet />
</Layout>
}
>
<Route path="/business/employees" element={<EmployeeList />} />
<Route path="/employees/create" element={<AddEmployee />} />
<Route path="/business/roles" element={<ManageRoles />} />
</Route>
</Routes>
</Refine>
</RefineSnackbarProvider>
</ColorModeContextProvider>
);
Title={Title}
Sider={Sider}
Layout={Layout}
Header={Header}
legacyRouterProvider={routerProvider}
legacyAuthProvider={authProvider}
LoginPage={Login}
DashboardPage={BusinessDetails}
>
<Routes>
<Route
element={
<Layout>
<Outlet />
</Layout>
}
>
<Route path="/business/employees" element={<EmployeeList />} />
<Route path="/employees/create" element={<AddEmployee />} />
<Route path="/business/roles" element={<ManageRoles />} />
</Route>
</Routes>
</Refine>
</RefineSnackbarProvider>
</ColorModeContextProvider>
);
13 replies
RRefine
Created by passive-yellow on 5/31/2023 in #ask-any-question
After adding a parent to my menuItem in the sidebar the create: AddEmployee is giving 404 error
@alicanerdurmaz This is the return:
return (
<ColorModeContextProvider>
<CssBaseline />
<GlobalStyles styles={{ html: { WebkitFontSmoothing: "auto" } }} />
<RefineSnackbarProvider>
<Refine
//Change for: https://brexons-prototype.onrender.com/api/v1
// dataProvider={dataProvider("http://localhost:3000/api/v1")}
dataProvider={dataProvider("https://brexons-prototype.onrender.com/api/v1")}
notificationProvider={notificationProvider}
ReadyPage={ReadyPage}
catchAll={<ErrorComponent />}
resources={[
{
name: "business",
key: "business",
icon: <ArchitectureOutlined
color="action"
/>,
meta: {
label: "My Business",
},
},

{
name: "employees",
list: "/business/employees",
create: "/business/employees/create",
icon: <PeopleIcon />,
meta: {
parent: "business",
},
},
{
name: "roles",
list: "/business/roles",
icon: <StarOutlineIcon />,
meta: {
parent: "business",
},
},
{
name: "building-plans",
list: BuildingPlan,
show: BuildingsDetail,
create: CreateBuildingPlan,
edit: EditBuildingPlan,
icon: <ArticleOutlined />,
},
{
name: "contracts",
list: AllContracts,
icon: <AddHomeWorkOutlinedIcon />,
},
{
name: "my-profile",
icon: <AccountCircleOutlined />,
meta: {
label: "My Profile",
},
list: MyProfile,
},
]}
...
return (
<ColorModeContextProvider>
<CssBaseline />
<GlobalStyles styles={{ html: { WebkitFontSmoothing: "auto" } }} />
<RefineSnackbarProvider>
<Refine
//Change for: https://brexons-prototype.onrender.com/api/v1
// dataProvider={dataProvider("http://localhost:3000/api/v1")}
dataProvider={dataProvider("https://brexons-prototype.onrender.com/api/v1")}
notificationProvider={notificationProvider}
ReadyPage={ReadyPage}
catchAll={<ErrorComponent />}
resources={[
{
name: "business",
key: "business",
icon: <ArchitectureOutlined
color="action"
/>,
meta: {
label: "My Business",
},
},

{
name: "employees",
list: "/business/employees",
create: "/business/employees/create",
icon: <PeopleIcon />,
meta: {
parent: "business",
},
},
{
name: "roles",
list: "/business/roles",
icon: <StarOutlineIcon />,
meta: {
parent: "business",
},
},
{
name: "building-plans",
list: BuildingPlan,
show: BuildingsDetail,
create: CreateBuildingPlan,
edit: EditBuildingPlan,
icon: <ArticleOutlined />,
},
{
name: "contracts",
list: AllContracts,
icon: <AddHomeWorkOutlinedIcon />,
},
{
name: "my-profile",
icon: <AccountCircleOutlined />,
meta: {
label: "My Profile",
},
list: MyProfile,
},
]}
...
13 replies
RRefine
Created by vicious-gold on 5/31/2023 in #ask-any-question
After adding a parent to my menuItem in the sidebar the create: AddEmployee is giving 404 error
So I can scroll down and see it fully, but what is the 404 error? Also the rest pages work as same (I need to scroll down for the module)
13 replies
RRefine
Created by unwilling-turquoise on 5/31/2023 in #ask-any-question
After adding a parent to my menuItem in the sidebar the create: AddEmployee is giving 404 error
No description
13 replies
RRefine
Created by rising-crimson on 5/31/2023 in #ask-any-question
After adding a parent to my menuItem in the sidebar the create: AddEmployee is giving 404 error
Thank, I manage to fix this but now its seems there is an extra side. the 404 error and under it is's showing the AddEmployee
13 replies
RRefine
Created by adverse-sapphire on 5/31/2023 in #ask-any-question
How to place my submenus on the right from the sider instead of placing them under it
I want just to modify the styling so not do show under the parent menu, but right to it. But I can compromise for now and later will change the whole Sidebar most likely 🙂
15 replies
RRefine
Created by correct-apricot on 5/31/2023 in #ask-any-question
How to place my submenus on the right from the sider instead of placing them under it
@kapa.ai
{
name: "business",
show: BusinessDetails,
icon: <ArchitectureOutlined />,
children: [
{
name: "employees",
list: EmployeeList,
create: AddEmployee,
icon: <PeopleIcon />,
},
],
},
{
name: "business",
show: BusinessDetails,
icon: <ArchitectureOutlined />,
children: [
{
name: "employees",
list: EmployeeList,
create: AddEmployee,
icon: <PeopleIcon />,
},
],
},
How to add Children Menu to my business?
15 replies
RRefine
Created by multiple-amethyst on 5/31/2023 in #ask-any-question
How to place my submenus on the right from the sider instead of placing them under it
@kapa.ai I would like to have my child element not to show under the employees but rather on its right side
resources={[
{
name: "building-plans",
list: BuildingPlan,
show: BuildingsDetail,
create: CreateBuildingPlan,
edit: EditBuildingPlan,
icon: <ArticleOutlined />,
},
{
name: "employees",
list: EmployeeList,
create: AddEmployee,
icon: <PeopleIcon />,
},
{
name: "contracts",
list: AllContracts,
icon: <AddHomeWorkOutlinedIcon />,
},
{
name: "my-profile",
icon: <AccountCircleOutlined />,
meta: {
label: "My Profile",
parent: "employees",
},
list: MyProfile,
},
]}
resources={[
{
name: "building-plans",
list: BuildingPlan,
show: BuildingsDetail,
create: CreateBuildingPlan,
edit: EditBuildingPlan,
icon: <ArticleOutlined />,
},
{
name: "employees",
list: EmployeeList,
create: AddEmployee,
icon: <PeopleIcon />,
},
{
name: "contracts",
list: AllContracts,
icon: <AddHomeWorkOutlinedIcon />,
},
{
name: "my-profile",
icon: <AccountCircleOutlined />,
meta: {
label: "My Profile",
parent: "employees",
},
list: MyProfile,
},
]}
15 replies
RRefine
Created by rival-black on 5/25/2023 in #ask-any-question
How to limit the display of resources from users parameters?
@alicanerdurmaz Any chance to help me implementing an access Controler?
20 replies
RRefine
Created by jolly-crimson on 5/25/2023 in #ask-any-question
How to limit the display of resources from users parameters?
This is my first refine app and I'm new with react either
20 replies
RRefine
Created by wise-white on 5/25/2023 in #ask-any-question
How to limit the display of resources from users parameters?
To use Access Control I will need to rewrite my userSchemas and add field for role? Right? I'm sure it is clear enough, but I'm struggeling still to understand refine, and even React... 😄
20 replies
RRefine
Created by harsh-harlequin on 5/25/2023 in #ask-any-question
How to limit the display of resources from users parameters?
I'm doing like this:
getUserIdentity: async () => {
const user = localStorage.getItem("user");
if (user) {
const parsedUser = JSON.parse(user);
return Promise.resolve({
...parsedUser,
hasParent: Boolean(parsedUser.parentUserID),
});
}
},
getUserIdentity: async () => {
const user = localStorage.getItem("user");
if (user) {
const parsedUser = JSON.parse(user);
return Promise.resolve({
...parsedUser,
hasParent: Boolean(parsedUser.parentUserID),
});
}
},
20 replies
RRefine
Created by inland-turquoise on 5/25/2023 in #ask-any-question
How to limit the display of resources from users parameters?
How should I implement own logic? For the solution @kapa.ai wrote, I'm getting error:
Uncaught Error: No QueryClient set, use QueryClientProvider to set one...
Uncaught Error: No QueryClient set, use QueryClientProvider to set one...
20 replies
RRefine
Created by fascinating-indigo on 5/25/2023 in #ask-any-question
How to limit the display of resources from users parameters?
I saw them, but I would like without them
20 replies