Fix error handle

fix pagination issue
change logic for change passsword and profile update
This commit is contained in:
2026-02-10 13:25:50 +07:00
parent 1d3e79c546
commit 5ffdd7454a
26 changed files with 339 additions and 213 deletions

View File

@@ -2,10 +2,10 @@ import { prisma } from '@/db';
import { OrganizationWhereInput } from '@/generated/prisma/models';
import { DB_TABLE, LOG_ACTION } from '@/types/enum';
import { auth } from '@lib/auth';
import { parseError } from '@lib/errors';
import { authMiddleware } from '@lib/middleware';
import { createServerFn } from '@tanstack/react-start';
import { getRequestHeaders } from '@tanstack/react-start/server';
import { parseError } from '@utils/helper';
import {
baseHouse,
houseCreateBESchema,
@@ -33,31 +33,30 @@ export const getAllHouse = createServerFn({ method: 'GET' })
],
};
const [list, total]: [OrganizationWithMembers[], number] =
await Promise.all([
await prisma.organization.findMany({
where,
orderBy: { createdAt: 'desc' },
include: {
members: {
select: {
role: true,
user: {
select: {
id: true,
name: true,
email: true,
image: true,
},
const [list, total]: [HouseWithMembers[], number] = await Promise.all([
await prisma.organization.findMany({
where,
orderBy: { createdAt: 'desc' },
include: {
members: {
select: {
role: true,
user: {
select: {
id: true,
name: true,
email: true,
image: true,
},
},
},
},
take: limit,
skip,
}),
await prisma.organization.count({ where }),
]);
},
take: limit,
skip,
}),
await prisma.organization.count({ where }),
]);
const totalPage = Math.ceil(+total / limit);