Skip to content

Commit ca4b83b

Browse files
authored
Merge pull request #2288 from leggedrobotics/fix/issue-2238-metadata-update-deletion
fix: metadata update mapping & tag deletion (issue #2238)
2 parents cd3ddc6 + 5e39de3 commit ca4b83b

6 files changed

Lines changed: 53 additions & 19 deletions

File tree

backend/src/services/queue.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export class QueueService implements OnModuleInit {
343343
}
344344
}
345345
}
346-
return {};
346+
return { success: true };
347347
}
348348

349349
async cancelProcessing(

backend/src/services/tag.service.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ export class TagService {
195195
value = Number.parseInt(value as string);
196196
}
197197

198-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
199-
(exsitingTag as any)[tagType.datatype] = value as number;
198+
exsitingTag.value_number = value as number;
200199
break;
201200
}
202201
throw new UnprocessableEntityException(
@@ -212,8 +211,7 @@ export class TagService {
212211
);
213212
}
214213

215-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
216-
(exsitingTag as any)[tagType.datatype] = value;
214+
exsitingTag.value_string = value;
217215
break;
218216
}
219217

@@ -223,8 +221,7 @@ export class TagService {
223221
value = value === 'true';
224222
}
225223

226-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
227-
(exsitingTag as any)[tagType.datatype] = value as boolean;
224+
exsitingTag.value_boolean = value as boolean;
228225
break;
229226
}
230227

@@ -239,8 +236,17 @@ export class TagService {
239236
);
240237
}
241238

242-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
243-
(exsitingTag as any)[tagType.datatype] = new Date(value);
239+
exsitingTag.value_date = new Date(value);
240+
break;
241+
}
242+
case DataType.LOCATION: {
243+
if (typeof value !== 'string') {
244+
throw new UnprocessableEntityException(
245+
'Value must be a string',
246+
);
247+
}
248+
249+
exsitingTag.value_location = value;
244250
break;
245251
}
246252

@@ -264,7 +270,7 @@ export class TagService {
264270

265271
async deleteTag(uuid: string): Promise<DeleteTagDto> {
266272
await this.tagRepository.delete({ uuid });
267-
return {};
273+
return { success: true };
268274
}
269275

270276
async getAll(skip: number, take: number): Promise<TagTypesDto> {

frontend/src/services/mutations/tag.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { DataType } from '@kleinkram/shared';
22
import axios from 'src/api/axios';
33

44
export const removeTag = async (tagUUID: string) => {
5-
const response = await axios.delete('/tag/deleteTag', {
6-
params: { uuid: tagUUID },
7-
});
5+
const response = await axios.delete(`/tag/${tagUUID}`);
86
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
97
return response.data;
108
};
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
2-
export class DeleteMissionResponseDto {}
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsBoolean } from 'class-validator';
3+
4+
export class DeleteMissionResponseDto {
5+
@ApiProperty({
6+
description: 'Indicates the deletion was successful',
7+
example: true,
8+
type: Boolean,
9+
})
10+
@IsBoolean()
11+
success!: boolean;
12+
}
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
2-
export class DeleteProjectResponseDto {}
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsBoolean } from 'class-validator';
3+
4+
export class DeleteProjectResponseDto {
5+
@ApiProperty({
6+
description: 'Indicates the deletion was successful',
7+
example: true,
8+
type: Boolean,
9+
})
10+
@IsBoolean()
11+
success!: boolean;
12+
}
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
2-
export class DeleteTagDto {}
1+
import { ApiProperty } from '@nestjs/swagger';
2+
import { IsBoolean } from 'class-validator';
3+
4+
export class DeleteTagDto {
5+
@ApiProperty({
6+
description: 'Indicates the deletion was successful',
7+
example: true,
8+
type: Boolean,
9+
})
10+
@IsBoolean()
11+
success!: boolean;
12+
}

0 commit comments

Comments
 (0)