F3.1: exponer merge cronológico en plataforma y APK
This commit is contained in:
@@ -0,0 +1,53 @@
|
|||||||
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
ParseUUIDPipe,
|
||||||
|
Post,
|
||||||
|
Req,
|
||||||
|
} from '@nestjs/common';
|
||||||
|
import { CurrentAuth } from '../auth/decorators/current-auth.decorator';
|
||||||
|
import { RequirePermissions } from '../authorization/decorators/require-permissions.decorator';
|
||||||
|
import type { AuthPrincipal, RequestWithContext } from '../common/http/request-context';
|
||||||
|
import { MergeInventoryAssetDto } from './dto/merge-inventory-asset.dto';
|
||||||
|
import { InventoryMergeService } from './inventory-merge.service';
|
||||||
|
|
||||||
|
@Controller('assets')
|
||||||
|
export class InventoryMergeController {
|
||||||
|
constructor(private readonly merges: InventoryMergeService) {}
|
||||||
|
|
||||||
|
@Get(':id/merge-status')
|
||||||
|
@RequirePermissions('assets.read')
|
||||||
|
status(@Param('id', new ParseUUIDPipe({ version: '4' })) id: string) {
|
||||||
|
return this.merges.status(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(':id/merge')
|
||||||
|
@RequirePermissions('assets.update')
|
||||||
|
merge(
|
||||||
|
@Param('id', new ParseUUIDPipe({ version: '4' })) id: string,
|
||||||
|
@Body() dto: MergeInventoryAssetDto,
|
||||||
|
@CurrentAuth() principal: AuthPrincipal,
|
||||||
|
@Req() request: RequestWithContext,
|
||||||
|
) {
|
||||||
|
return this.merges.merge(id, dto, principal, request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Controller('inspection-visits/:visitId/field-inventory')
|
||||||
|
export class FieldInventoryMergeController {
|
||||||
|
constructor(private readonly merges: InventoryMergeService) {}
|
||||||
|
|
||||||
|
@Post(':assetId/merge')
|
||||||
|
@RequirePermissions('assets.create', 'inspections.execute')
|
||||||
|
mergeFieldDiscovery(
|
||||||
|
@Param('visitId', new ParseUUIDPipe({ version: '4' })) visitId: string,
|
||||||
|
@Param('assetId', new ParseUUIDPipe({ version: '4' })) assetId: string,
|
||||||
|
@Body() dto: MergeInventoryAssetDto,
|
||||||
|
@CurrentAuth() principal: AuthPrincipal,
|
||||||
|
@Req() request: RequestWithContext,
|
||||||
|
) {
|
||||||
|
return this.merges.mergeFromVisit(visitId, assetId, dto, principal, request);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user