updated living space add list updagte

This commit is contained in:
2025-11-29 12:31:05 +03:00
parent eaca36573e
commit d22fc017df
35 changed files with 858 additions and 126 deletions

View File

@@ -6,40 +6,36 @@ const endpoint = "http://localhost:3001/graphql";
export async function POST(request: Request) {
const body = await request.json();
const { limit, skip, sort, filters } = body;
const { limit, skip, sort, filters, buildID } = body;
try {
const client = new GraphQLClient(endpoint);
const query = gql`
query GetCompanies($input: ListArguments!) {
getCompanies(input:$input) {
query GetLivingSpaces($input: ListArguments!, $buildID: String!) {
getLivingSpaces(input: $input, buildID: $buildID) {
data {
_id
uuid
company_type
commercial_type
tax_no
default_lang_type
default_money_type
is_commercial
is_blacklist
workplace_no
official_address
top_responsible_company
parent_id
company_tag
formal_name
public_name
parent_id
expiryStarts
build
part
userType
company
person
isNotificationSend
expiryEnds
expiryStarts
createdAt
updatedAt
isConfirmed
deleted
}
totalCount
}
}
`;
const variables = { input: { limit, skip, sort, filters } };
const variables = { input: { limit, skip, sort, filters }, buildID };
const data = await client.request(query, variables);
return NextResponse.json({ data: data.getCompanies.data, totalCount: data.getCompanies.totalCount });
return NextResponse.json({ data: data.getLivingSpaces.data, totalCount: data.getLivingSpaces.totalCount });
} catch (err: any) {
console.error(err);
return NextResponse.json({ error: err.message }, { status: 500 });