mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-11 16:18:40 +00:00
continue implementations
This commit is contained in:
parent
9855b02278
commit
3710d3d923
|
|
@ -61,7 +61,23 @@ final class ApiAddressAttributeController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = AddressAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
|
$type = AddressAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
|
||||||
|
|
||||||
|
if (!$type->repeatable) {
|
||||||
|
$attr = AddressAttributeMapper::count()
|
||||||
|
->with('type')
|
||||||
|
->where('type/id', (int) $request->getData('type'))
|
||||||
|
->where('ref', (int) $request->getData('ref'))
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
if ($attr > 0) {
|
||||||
|
$response->header->status = RequestStatusCode::R_409;
|
||||||
|
$this->createInvalidCreateResponse($request, $response, $val);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$attribute = $this->createAttributeFromRequest($request, $type);
|
$attribute = $this->createAttributeFromRequest($request, $type);
|
||||||
$this->createModel($request->header->account, $attribute, AddressAttributeMapper::class, 'attribute', $request->getOrigin());
|
$this->createModel($request->header->account, $attribute, AddressAttributeMapper::class, 'attribute', $request->getOrigin());
|
||||||
$this->createStandardCreateResponse($request, $response, $attribute);
|
$this->createStandardCreateResponse($request, $response, $attribute);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,23 @@ final class ApiAttributeController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = UnitAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
|
$type = UnitAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
|
||||||
|
|
||||||
|
if (!$type->repeatable) {
|
||||||
|
$attr = UnitAttributeMapper::count()
|
||||||
|
->with('type')
|
||||||
|
->where('type/id', (int) $request->getData('type'))
|
||||||
|
->where('ref', (int) $request->getData('ref'))
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
if ($attr > 0) {
|
||||||
|
$response->header->status = RequestStatusCode::R_409;
|
||||||
|
$this->createInvalidCreateResponse($request, $response, $val);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$attribute = $this->createAttributeFromRequest($request, $type);
|
$attribute = $this->createAttributeFromRequest($request, $type);
|
||||||
$this->createModel($request->header->account, $attribute, UnitAttributeMapper::class, 'attribute', $request->getOrigin());
|
$this->createModel($request->header->account, $attribute, UnitAttributeMapper::class, 'attribute', $request->getOrigin());
|
||||||
$this->createStandardCreateResponse($request, $response, $attribute);
|
$this->createStandardCreateResponse($request, $response, $attribute);
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ final class AddressAttributeTypeMapper extends DataMapperFactory
|
||||||
'address_attr_type_datatype' => ['name' => 'address_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
'address_attr_type_datatype' => ['name' => 'address_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
||||||
'address_attr_type_fields' => ['name' => 'address_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
'address_attr_type_fields' => ['name' => 'address_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||||
'address_attr_type_custom' => ['name' => 'address_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
'address_attr_type_custom' => ['name' => 'address_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
||||||
|
'address_attr_type_repeatable' => ['name' => 'address_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
|
||||||
'address_attr_type_pattern' => ['name' => 'address_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
'address_attr_type_pattern' => ['name' => 'address_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
||||||
'address_attr_type_required' => ['name' => 'address_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
'address_attr_type_required' => ['name' => 'address_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ final class AddressAttributeValueMapper extends DataMapperFactory
|
||||||
'mapper' => AddressAttributeValueL11nMapper::class,
|
'mapper' => AddressAttributeValueL11nMapper::class,
|
||||||
'table' => 'address_attr_value_l11n',
|
'table' => 'address_attr_value_l11n',
|
||||||
'self' => 'address_attr_value_l11n_value',
|
'self' => 'address_attr_value_l11n_value',
|
||||||
|
'column' => 'content',
|
||||||
'external' => null,
|
'external' => null,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ final class UnitAttributeTypeMapper extends DataMapperFactory
|
||||||
'unit_attr_type_datatype' => ['name' => 'unit_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
'unit_attr_type_datatype' => ['name' => 'unit_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
||||||
'unit_attr_type_fields' => ['name' => 'unit_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
'unit_attr_type_fields' => ['name' => 'unit_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||||
'unit_attr_type_custom' => ['name' => 'unit_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
'unit_attr_type_custom' => ['name' => 'unit_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
||||||
|
'unit_attr_type_repeatable' => ['name' => 'unit_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
|
||||||
'unit_attr_type_pattern' => ['name' => 'unit_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
'unit_attr_type_pattern' => ['name' => 'unit_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
||||||
'unit_attr_type_required' => ['name' => 'unit_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
'unit_attr_type_required' => ['name' => 'unit_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ final class UnitAttributeValueMapper extends DataMapperFactory
|
||||||
'mapper' => UnitAttributeValueL11nMapper::class,
|
'mapper' => UnitAttributeValueL11nMapper::class,
|
||||||
'table' => 'unit_attr_value_l11n',
|
'table' => 'unit_attr_value_l11n',
|
||||||
'self' => 'unit_attr_value_l11n_value',
|
'self' => 'unit_attr_value_l11n_value',
|
||||||
|
'column' => 'content',
|
||||||
'external' => null,
|
'external' => null,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user