Skip to content

Commit

Permalink
debug: print query conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjdd committed Oct 24, 2023
1 parent 728c4e0 commit f8bce61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions next/api/src/orm/clickhouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export class ClickHouse {

async find() {
const sql = this.toSqlString();
console.log('clickhouse sql', sql);
return await ClickHouse.findWithSqlStr<QueryData>(sql);
}

Expand Down
4 changes: 4 additions & 0 deletions next/api/src/router/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ router.get(
});
}

console.log('find ticket query', finalQuery.getRawCondition());

let tickets: Ticket[];
if (params.count && !count) {
const result = await finalQuery.findAndCount(currentUser.getAuthOptions());
Expand Down Expand Up @@ -393,6 +395,8 @@ router.get(

const queryString = conditions.join(' AND ');

console.log({ queryString });

const searchQuery = new AV.SearchQuery('Ticket');
searchQuery.queryString(queryString);
sortFields?.forEach(({ key, order }) => {
Expand Down
1 change: 1 addition & 0 deletions next/api/src/ticket/export/ExportTicket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ export default async function exportTicket({ params, sortItems, utcOffset, date
const exportFileManager = new ExportFileManager(fileName);
debug('count tickets');
const [query, containFields] = await createBaseTicketQuery(rest, sortItems);
console.log('export query condition', query.getRawCondition());
const count = await query.count(authOptions);
debug('count: ', count);
const categoryMap = await getCategories();
Expand Down

0 comments on commit f8bce61

Please sign in to comment.