Add order_priority field to departments
- Introduce `order_priority` property in `departments_o.php`. - Update `departmentsRoute.php` to handle `order_priority` in input and output. - Adjust object initialization and serialization for the new field.
This commit is contained in:
@@ -23,6 +23,7 @@ class departments_o extends db
|
||||
public object_property $branding; // The branding of the department
|
||||
public object_property $longitude; // The longitude of the department (Can be null)
|
||||
public object_property $latitude; // The latitude of the department (Can be null)
|
||||
public object_property $order_priority; // The order priority of the department (Lower number = higher priority)
|
||||
public object_property $created_at;
|
||||
public object_property $updated_at;
|
||||
|
||||
@@ -91,6 +92,7 @@ class departments_o extends db
|
||||
$this->visible = new object_property($this->table, $this->id, 'visible', 'int', false);
|
||||
$this->longitude = new object_property($this->table, $this->id, 'longitude', 'float', false);
|
||||
$this->latitude = new object_property($this->table, $this->id, 'latitude', 'float', false);
|
||||
$this->order_priority = new object_property($this->table, $this->id, 'order_priority', 'int', false);
|
||||
$this->created_at = new object_property($this->table, $this->id, 'created_at', 'string', false);
|
||||
$this->updated_at = new object_property($this->table, $this->id, 'updated_at', 'string', false);
|
||||
}
|
||||
@@ -311,6 +313,7 @@ class departments_o extends db
|
||||
'branding' => (int)$this->branding->value(),
|
||||
'longitude' => (float)$this->longitude->value(),
|
||||
'latitude' => (float)$this->latitude->value(),
|
||||
'order_priority' => (int)$this->order_priority->value(),
|
||||
'created_at' => (string)$this->created_at->value(),
|
||||
'updated_at' => (string)$this->updated_at->value(),
|
||||
];
|
||||
|
||||
@@ -62,7 +62,8 @@ class departmentsRoute
|
||||
'dimension' => (int)$department['dimension'],
|
||||
'branding' => (int)$department['branding'],
|
||||
'longitude' => (float)$department['longitude'],
|
||||
'latitude' => (float)$department['latitude']
|
||||
'latitude' => (float)$department['latitude'],
|
||||
'order_priority' => (int)$department['order_priority'],
|
||||
];
|
||||
// If the user has the permission to view the slack webhook, add it to the response
|
||||
if ($user->hasPermission('view_slack_webhook')) {
|
||||
@@ -154,6 +155,9 @@ class departmentsRoute
|
||||
if (self::isParametersSet(['longitude'])) {
|
||||
$department->longitude->set(self::getParameter('longitude'));
|
||||
}
|
||||
if (self::isParametersSet(['order_priority'])) {
|
||||
$department->order_priority->set((int)self::getParameter('order_priority'));
|
||||
}
|
||||
// Log the incident
|
||||
(new logs_o())->add('departments', (int)self::getParameter('id'), 1, $user->id, 'EDIT_DEPARTMENT', 'Successfully edited a department');
|
||||
// Return a success message
|
||||
|
||||
Reference in New Issue
Block a user