Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Oct 7, 2024
1 parent 5cfa045 commit 8a743f6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddColumnNameToIndexFieldMetadata1726762935841
implements MigrationInterface
{
name = 'AddColumnNameToIndexFieldMetadata1726762935841';
name = 'AddCompositeColumnToIndexFieldMetadata1726762935841';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,60 +108,6 @@ export class GraphqlQueryCreateManyResolverService
): Promise<void> {
assertMutationNotOnRemoteObject(options.objectMetadataItem);

/*
const uniqueIndexes = options.objectMetadataItem.indexes.filter(
(index) => index.isUnique,
);
uniqueIndexes.forEach((index) => {
const recordMap = new Map<string, Set<string>>();
args.data.forEach((record, index) => {
index.fields.forEach((fieldName) => {
const value = record[fieldName];
});
});
});
if (uniqueIndexes.length > 0) {
const recordMap = new Map<string, Set<string>>();
args.data.forEach((record, index) => {
uniqueIndexes.forEach((fieldName) => {
const value = record[fieldName];
if (value !== undefined && value !== null) {
const key = `${fieldName}:${value}`;
if (!recordMap.has(key)) {
recordMap.set(key, new Set());
}
recordMap.get(key)?.add(index.toString());
}
});
});
const violations = Array.from(recordMap.entries())
.filter(([, indexes]) => indexes.size > 1)
.map(([key, indexes]) => {
const [fieldName, value] = key.split(':');
return {
field: fieldName,
value: value,
indexes: Array.from(indexes).map(Number),
};
});
if (violations.length > 0) {
throw new Error(
`Unique constraint violation(s) detected: ${JSON.stringify(
violations,
)}`,
);
}
}
*/
args.data.forEach((record) => {
if (record?.id) {
assertIsValidUuid(record.id);
Expand Down

0 comments on commit 8a743f6

Please sign in to comment.