-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add cluster matching sync timestamp and logs #1913
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; | ||
|
||
export class addClusterMatchingSyncAtTimestamp1737544105947 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const table = await queryRunner.getTable('qf_round'); | ||
const columnExists = table?.findColumnByName('clusterMatchingSyncAt'); | ||
|
||
if (!columnExists) { | ||
await queryRunner.addColumn( | ||
'qf_round', | ||
new TableColumn({ | ||
name: 'clusterMatchingSyncAt', | ||
type: 'timestamp', | ||
isNullable: true, | ||
}), | ||
); | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropColumn('qf_round', 'clusterMatchingSyncAt'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,12 +14,20 @@ export type EstimatedClusterMatchingWorker = | |||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
const worker: EstimatedClusterMatchingWorker = { | ||||||||||||||||||||||||||||||||||||||||||||||||
async fetchEstimatedClusterMatching(matchingDataInput: any) { | ||||||||||||||||||||||||||||||||||||||||||||||||
return await getClusterMatchingAdapter().fetchEstimatedClusterMatchings( | ||||||||||||||||||||||||||||||||||||||||||||||||
matchingDataInput, | ||||||||||||||||||||||||||||||||||||||||||||||||
logger.debug('fetchEstimatedClusterMatching() has been called'); | ||||||||||||||||||||||||||||||||||||||||||||||||
const matchingData = | ||||||||||||||||||||||||||||||||||||||||||||||||
await getClusterMatchingAdapter().fetchEstimatedClusterMatchings( | ||||||||||||||||||||||||||||||||||||||||||||||||
matchingDataInput, | ||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||
logger.debug( | ||||||||||||||||||||||||||||||||||||||||||||||||
'fetchEstimatedClusterMatching() has worked with params', | ||||||||||||||||||||||||||||||||||||||||||||||||
String(matchingData), | ||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||
return matchingData; | ||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+17
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve logging security for matchingData. Converting matchingData directly to string could expose sensitive information in logs. Consider logging only necessary metadata. Suggested improvement: - logger.debug(
- 'fetchEstimatedClusterMatching() has worked with params',
- String(matchingData),
- );
+ logger.debug(
+ 'fetchEstimatedClusterMatching() completed',
+ {
+ recordCount: matchingData?.length || 0,
+ timestamp: new Date().toISOString()
+ }
+ ); 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
async updateEstimatedClusterMatching(qfRoundId: number, matchingData: any) { | ||||||||||||||||||||||||||||||||||||||||||||||||
logger.debug('updateEstimatedClusterMatching() has been called'); | ||||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||||
const params: any[] = []; | ||||||||||||||||||||||||||||||||||||||||||||||||
const values = matchingData | ||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align GraphQL and database column nullability.
The field is nullable in the database but required in GraphQL. This mismatch could cause runtime errors when the field is null.
Update the field definition to match nullability:
📝 Committable suggestion