huridocs/uwazi

View on GitHub
app/api/relationships.v2/routes/validators/upsertRelationshipMigrationFields.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { createValidator, ValidatorSchema } from 'api/common.v2/validation/routesValidation';
import { UpdateRelationshipMigrationFieldRequest } from 'shared/types/api.v2/relationshipMigrationField.update';

const schema: ValidatorSchema<UpdateRelationshipMigrationFieldRequest> = {
  properties: {
    sourceTemplate: {
      type: 'string',
    },
    relationType: {
      type: 'string',
    },
  },
  optionalProperties: {
    ignored: {
      type: 'boolean',
    },
    targetTemplate: {
      type: 'string',
    },
  },
};

export const validateUpsertRelationshipMigrationField = createValidator(schema);