| @@ 18-245 (lines=228) @@ | ||
| 15 | use HRis\Api\Requests\Profile\DependentsRequest; |
|
| 16 | use Swagger\Annotations as SWG; |
|
| 17 | ||
| 18 | class DependentsController extends BaseController |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var Employee |
|
| 22 | */ |
|
| 23 | protected $employee; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @var Dependent |
|
| 27 | */ |
|
| 28 | protected $dependent; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Employee $employee |
|
| 32 | * @param Dependent $dependent |
|
| 33 | * |
|
| 34 | * @author Bertrand Kintanar <[email protected]> |
|
| 35 | */ |
|
| 36 | public function __construct(Employee $employee, Dependent $dependent) |
|
| 37 | { |
|
| 38 | $this->employee = $employee; |
|
| 39 | $this->dependent = $dependent; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Save the Profile - Dependents. |
|
| 44 | * |
|
| 45 | * @SWG\Post( |
|
| 46 | * path="/profile/dependents", |
|
| 47 | * tags={"Employee Profiles"}, |
|
| 48 | * consumes={"application/json"}, |
|
| 49 | * summary="Save the Profile - Dependents.", |
|
| 50 | * @SWG\Response(response="201", description="Success", |
|
| 51 | * @SWG\Schema( |
|
| 52 | * title="data", |
|
| 53 | * type="object", |
|
| 54 | * required={"dependent", "message", "status_code"}, |
|
| 55 | * @SWG\Property(property="emergency_contact", ref="#/definitions/Dependent"), |
|
| 56 | * @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"), |
|
| 57 | * @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"), |
|
| 58 | * ) |
|
| 59 | * ), |
|
| 60 | * @SWG\Response(response="400", description="Token not provided", |
|
| 61 | * @SWG\Schema( |
|
| 62 | * title="data", |
|
| 63 | * type="object", |
|
| 64 | * required={"message", "status_code", "debug"}, |
|
| 65 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 66 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 67 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 68 | * ) |
|
| 69 | * ), |
|
| 70 | * @SWG\Response(response="422", description="Unable to add record to the database.", |
|
| 71 | * @SWG\Schema( |
|
| 72 | * title="data", |
|
| 73 | * type="object", |
|
| 74 | * required={"message", "status_code"}, |
|
| 75 | * @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"), |
|
| 76 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 77 | * ) |
|
| 78 | * ), |
|
| 79 | * @SWG\Parameter( |
|
| 80 | * name="dependent", |
|
| 81 | * in="body", |
|
| 82 | * required=true, |
|
| 83 | * @SWG\Property(ref="#/definitions/Dependent") |
|
| 84 | * ), |
|
| 85 | * @SWG\Parameter( |
|
| 86 | * name="Authorization", |
|
| 87 | * in="header", |
|
| 88 | * description="JWT Token", |
|
| 89 | * required=true, |
|
| 90 | * type="string", |
|
| 91 | * default="Bearer " |
|
| 92 | * ), |
|
| 93 | * ) |
|
| 94 | * |
|
| 95 | * @param DependentsRequest $request |
|
| 96 | * |
|
| 97 | * @return \Dingo\Api\Http\Response |
|
| 98 | * |
|
| 99 | * @author Bertrand Kintanar <[email protected]> |
|
| 100 | */ |
|
| 101 | public function store(DependentsRequest $request) |
|
| 102 | { |
|
| 103 | return $this->storeModel($request, $this->dependent, 'dependent'); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Update the Profile - Dependents. |
|
| 108 | * |
|
| 109 | * @SWG\Patch( |
|
| 110 | * path="/profile/dependents", |
|
| 111 | * tags={"Employee Profiles"}, |
|
| 112 | * consumes={"application/json"}, |
|
| 113 | * summary="Update the Profile - Dependents.", |
|
| 114 | * @SWG\Response(response="200", description="Success", |
|
| 115 | * @SWG\Schema( |
|
| 116 | * title="data", |
|
| 117 | * type="object", |
|
| 118 | * required={"message", "status_code"}, |
|
| 119 | * @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"), |
|
| 120 | * @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"), |
|
| 121 | * ) |
|
| 122 | * ), |
|
| 123 | * @SWG\Response(response="400", description="Token not provided", |
|
| 124 | * @SWG\Schema( |
|
| 125 | * title="data", |
|
| 126 | * type="object", |
|
| 127 | * required={"message", "status_code", "debug"}, |
|
| 128 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 129 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 130 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 131 | * ) |
|
| 132 | * ), |
|
| 133 | * @SWG\Response(response="404", description="Unable to retrieve record from database.", |
|
| 134 | * @SWG\Schema( |
|
| 135 | * title="data", |
|
| 136 | * type="object", |
|
| 137 | * required={"message", "status_code", "debug"}, |
|
| 138 | * @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"), |
|
| 139 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 140 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 141 | * ) |
|
| 142 | * ), |
|
| 143 | * @SWG\Response(response="422", description="Unable to update record.", |
|
| 144 | * @SWG\Schema( |
|
| 145 | * title="data", |
|
| 146 | * type="object", |
|
| 147 | * required={"message", "status_code"}, |
|
| 148 | * @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"), |
|
| 149 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 150 | * ) |
|
| 151 | * ), |
|
| 152 | * @SWG\Parameter( |
|
| 153 | * name="dependent", |
|
| 154 | * in="body", |
|
| 155 | * required=true, |
|
| 156 | * description="employee's dependent object that needs to be updated", |
|
| 157 | * @SWG\Property(ref="#/definitions/Dependent") |
|
| 158 | * ), |
|
| 159 | * @SWG\Parameter( |
|
| 160 | * name="Authorization", |
|
| 161 | * in="header", |
|
| 162 | * description="JWT Token", |
|
| 163 | * required=true, |
|
| 164 | * type="string", |
|
| 165 | * default="Bearer " |
|
| 166 | * ), |
|
| 167 | * ) |
|
| 168 | * |
|
| 169 | * @param DependentsRequest $request |
|
| 170 | * |
|
| 171 | * @return \Dingo\Api\Http\Response |
|
| 172 | * |
|
| 173 | * @author Bertrand Kintanar <[email protected]> |
|
| 174 | */ |
|
| 175 | public function update(DependentsRequest $request) |
|
| 176 | { |
|
| 177 | return $this->updateModel($request, $this->dependent); |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * Delete the Profile - Dependents. |
|
| 182 | * |
|
| 183 | * @SWG\Delete( |
|
| 184 | * path="/profile/dependents", |
|
| 185 | * tags={"Employee Profiles"}, |
|
| 186 | * consumes={"application/json"}, |
|
| 187 | * summary="Delete the Profile - Dependents.", |
|
| 188 | * @SWG\Response(response="200", description="Success", |
|
| 189 | * @SWG\Schema( |
|
| 190 | * title="data", |
|
| 191 | * type="object", |
|
| 192 | * required={"message", "status_code"}, |
|
| 193 | * @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"), |
|
| 194 | * @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"), |
|
| 195 | * ) |
|
| 196 | * ), |
|
| 197 | * @SWG\Response(response="400", description="Token not provided", |
|
| 198 | * @SWG\Schema( |
|
| 199 | * title="data", |
|
| 200 | * type="object", |
|
| 201 | * required={"message", "status_code", "debug"}, |
|
| 202 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 203 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 204 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 205 | * ) |
|
| 206 | * ), |
|
| 207 | * @SWG\Response(response="422", description="Unable to delete record from the database.", |
|
| 208 | * @SWG\Schema( |
|
| 209 | * title="data", |
|
| 210 | * type="object", |
|
| 211 | * required={"message", "status_code"}, |
|
| 212 | * @SWG\Property(property="message", type="string", default="Unable to delete record from the database.", description="Status message from server"), |
|
| 213 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 214 | * ) |
|
| 215 | * ), |
|
| 216 | * @SWG\Parameter( |
|
| 217 | * name="id", |
|
| 218 | * in="formData", |
|
| 219 | * description="Employee's dependent id to be deleted", |
|
| 220 | * required=true, |
|
| 221 | * type="integer", |
|
| 222 | * format="int64", |
|
| 223 | * default=1, |
|
| 224 | * ), |
|
| 225 | * @SWG\Parameter( |
|
| 226 | * name="Authorization", |
|
| 227 | * in="header", |
|
| 228 | * description="JWT Token", |
|
| 229 | * required=true, |
|
| 230 | * type="string", |
|
| 231 | * default="Bearer " |
|
| 232 | * ), |
|
| 233 | * ) |
|
| 234 | * |
|
| 235 | * @param DependentsRequest $request |
|
| 236 | * |
|
| 237 | * @return \Dingo\Api\Http\Response |
|
| 238 | * |
|
| 239 | * @author Bertrand Kintanar <[email protected]> |
|
| 240 | */ |
|
| 241 | public function destroy(DependentsRequest $request) |
|
| 242 | { |
|
| 243 | return $this->destroyModel($request, $this->dependent); |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| @@ 18-245 (lines=228) @@ | ||
| 15 | use HRis\Api\Requests\Profile\EmergencyContactsRequest; |
|
| 16 | use Swagger\Annotations as SWG; |
|
| 17 | ||
| 18 | class EmergencyContactsController extends BaseController |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var Employee |
|
| 22 | */ |
|
| 23 | protected $employee; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @var EmergencyContact |
|
| 27 | */ |
|
| 28 | protected $emergency_contact; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Employee $employee |
|
| 32 | * @param EmergencyContact $emergency_contact |
|
| 33 | * |
|
| 34 | * @author Bertrand Kintanar <[email protected]> |
|
| 35 | */ |
|
| 36 | public function __construct(Employee $employee, EmergencyContact $emergency_contact) |
|
| 37 | { |
|
| 38 | $this->employee = $employee; |
|
| 39 | $this->emergency_contact = $emergency_contact; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Save the Profile - Emergency Contacts. |
|
| 44 | * |
|
| 45 | * @SWG\Post( |
|
| 46 | * path="/profile/emergency-contacts", |
|
| 47 | * tags={"Employee Profiles"}, |
|
| 48 | * consumes={"application/json"}, |
|
| 49 | * summary="Save the Profile - Emergency Contacts.", |
|
| 50 | * @SWG\Response(response="201", description="Success", |
|
| 51 | * @SWG\Schema( |
|
| 52 | * title="data", |
|
| 53 | * type="object", |
|
| 54 | * required={"emergency_contact", "message", "status_code"}, |
|
| 55 | * @SWG\Property(property="emergency_contact", ref="#/definitions/EmergencyContact"), |
|
| 56 | * @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"), |
|
| 57 | * @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"), |
|
| 58 | * ) |
|
| 59 | * ), |
|
| 60 | * @SWG\Response(response="400", description="Token not provided", |
|
| 61 | * @SWG\Schema( |
|
| 62 | * title="data", |
|
| 63 | * type="object", |
|
| 64 | * required={"message", "status_code", "debug"}, |
|
| 65 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 66 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 67 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 68 | * ) |
|
| 69 | * ), |
|
| 70 | * @SWG\Response(response="422", description="Unable to add record to the database.", |
|
| 71 | * @SWG\Schema( |
|
| 72 | * title="data", |
|
| 73 | * type="object", |
|
| 74 | * required={"message", "status_code"}, |
|
| 75 | * @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"), |
|
| 76 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 77 | * ) |
|
| 78 | * ), |
|
| 79 | * @SWG\Parameter( |
|
| 80 | * name="emergency_contact", |
|
| 81 | * in="body", |
|
| 82 | * required=true, |
|
| 83 | * @SWG\Property(ref="#/definitions/EmergencyContact") |
|
| 84 | * ), |
|
| 85 | * @SWG\Parameter( |
|
| 86 | * name="Authorization", |
|
| 87 | * in="header", |
|
| 88 | * description="JWT Token", |
|
| 89 | * required=true, |
|
| 90 | * type="string", |
|
| 91 | * default="Bearer " |
|
| 92 | * ), |
|
| 93 | * ) |
|
| 94 | * |
|
| 95 | * @param EmergencyContactsRequest $request |
|
| 96 | * |
|
| 97 | * @return \Dingo\Api\Http\Response |
|
| 98 | * |
|
| 99 | * @author Bertrand Kintanar <[email protected]> |
|
| 100 | */ |
|
| 101 | public function store(EmergencyContactsRequest $request) |
|
| 102 | { |
|
| 103 | return $this->storeModel($request, $this->emergency_contact, 'emergency_contact'); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Update the Profile - Emergency Contacts. |
|
| 108 | * |
|
| 109 | * @SWG\Patch( |
|
| 110 | * path="/profile/emergency-contacts", |
|
| 111 | * tags={"Employee Profiles"}, |
|
| 112 | * consumes={"application/json"}, |
|
| 113 | * summary="Update the Profile - Emergency Contacts.", |
|
| 114 | * @SWG\Response(response="200", description="Success", |
|
| 115 | * @SWG\Schema( |
|
| 116 | * title="data", |
|
| 117 | * type="object", |
|
| 118 | * required={"message", "status_code"}, |
|
| 119 | * @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"), |
|
| 120 | * @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"), |
|
| 121 | * ) |
|
| 122 | * ), |
|
| 123 | * @SWG\Response(response="400", description="Token not provided", |
|
| 124 | * @SWG\Schema( |
|
| 125 | * title="data", |
|
| 126 | * type="object", |
|
| 127 | * required={"message", "status_code", "debug"}, |
|
| 128 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 129 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 130 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 131 | * ) |
|
| 132 | * ), |
|
| 133 | * @SWG\Response(response="404", description="Unable to retrieve record from database.", |
|
| 134 | * @SWG\Schema( |
|
| 135 | * title="data", |
|
| 136 | * type="object", |
|
| 137 | * required={"message", "status_code", "debug"}, |
|
| 138 | * @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"), |
|
| 139 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 140 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 141 | * ) |
|
| 142 | * ), |
|
| 143 | * @SWG\Response(response="422", description="Unable to update record.", |
|
| 144 | * @SWG\Schema( |
|
| 145 | * title="data", |
|
| 146 | * type="object", |
|
| 147 | * required={"message", "status_code"}, |
|
| 148 | * @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"), |
|
| 149 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 150 | * ) |
|
| 151 | * ), |
|
| 152 | * @SWG\Parameter( |
|
| 153 | * name="emergency_contact", |
|
| 154 | * in="body", |
|
| 155 | * required=true, |
|
| 156 | * description="employee's emergency contact object that needs to be updated", |
|
| 157 | * @SWG\Property(ref="#/definitions/EmergencyContact") |
|
| 158 | * ), |
|
| 159 | * @SWG\Parameter( |
|
| 160 | * name="Authorization", |
|
| 161 | * in="header", |
|
| 162 | * description="JWT Token", |
|
| 163 | * required=true, |
|
| 164 | * type="string", |
|
| 165 | * default="Bearer " |
|
| 166 | * ), |
|
| 167 | * ) |
|
| 168 | * |
|
| 169 | * @param EmergencyContactsRequest $request |
|
| 170 | * |
|
| 171 | * @return \Dingo\Api\Http\Response |
|
| 172 | * |
|
| 173 | * @author Bertrand Kintanar <[email protected]> |
|
| 174 | */ |
|
| 175 | public function update(EmergencyContactsRequest $request) |
|
| 176 | { |
|
| 177 | return $this->updateModel($request, $this->emergency_contact); |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * Delete the Profile - Emergency Contacts. |
|
| 182 | * |
|
| 183 | * @SWG\Delete( |
|
| 184 | * path="/profile/emergency-contacts", |
|
| 185 | * tags={"Employee Profiles"}, |
|
| 186 | * consumes={"application/json"}, |
|
| 187 | * summary="Delete the Profile - Emergency Contacts.", |
|
| 188 | * @SWG\Response(response="200", description="Success", |
|
| 189 | * @SWG\Schema( |
|
| 190 | * title="data", |
|
| 191 | * type="object", |
|
| 192 | * required={"message", "status_code"}, |
|
| 193 | * @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"), |
|
| 194 | * @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"), |
|
| 195 | * ) |
|
| 196 | * ), |
|
| 197 | * @SWG\Response(response="400", description="Token not provided", |
|
| 198 | * @SWG\Schema( |
|
| 199 | * title="data", |
|
| 200 | * type="object", |
|
| 201 | * required={"message", "status_code", "debug"}, |
|
| 202 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 203 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 204 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 205 | * ) |
|
| 206 | * ), |
|
| 207 | * @SWG\Response(response="422", description="Unable to delete record from the database.", |
|
| 208 | * @SWG\Schema( |
|
| 209 | * title="data", |
|
| 210 | * type="object", |
|
| 211 | * required={"message", "status_code"}, |
|
| 212 | * @SWG\Property(property="message", type="string", default="Unable to delete record from the database.", description="Status message from server"), |
|
| 213 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 214 | * ) |
|
| 215 | * ), |
|
| 216 | * @SWG\Parameter( |
|
| 217 | * name="id", |
|
| 218 | * in="formData", |
|
| 219 | * description="Employee's emergency contact id to be deleted", |
|
| 220 | * required=true, |
|
| 221 | * type="integer", |
|
| 222 | * format="int64", |
|
| 223 | * default=1, |
|
| 224 | * ), |
|
| 225 | * @SWG\Parameter( |
|
| 226 | * name="Authorization", |
|
| 227 | * in="header", |
|
| 228 | * description="JWT Token", |
|
| 229 | * required=true, |
|
| 230 | * type="string", |
|
| 231 | * default="Bearer " |
|
| 232 | * ), |
|
| 233 | * ) |
|
| 234 | * |
|
| 235 | * @param EmergencyContactsRequest $request |
|
| 236 | * |
|
| 237 | * @return \Dingo\Api\Http\Response |
|
| 238 | * |
|
| 239 | * @author Bertrand Kintanar <[email protected]> |
|
| 240 | */ |
|
| 241 | public function destroy(EmergencyContactsRequest $request) |
|
| 242 | { |
|
| 243 | return $this->destroyModel($request, $this->emergency_contact); |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| @@ 18-245 (lines=228) @@ | ||
| 15 | use HRis\Api\Requests\Profile\ReportsToRequest; |
|
| 16 | use Swagger\Annotations as SWG; |
|
| 17 | ||
| 18 | class ReportsToController extends BaseController |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var Employee |
|
| 22 | */ |
|
| 23 | protected $employee; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @var EmployeeSupervisor |
|
| 27 | */ |
|
| 28 | protected $employee_supervisor; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Employee $employee |
|
| 32 | * @param EmployeeSupervisor $employee_supervisor |
|
| 33 | * |
|
| 34 | * @author Bertrand Kintanar <[email protected]> |
|
| 35 | */ |
|
| 36 | public function __construct(Employee $employee, EmployeeSupervisor $employee_supervisor) |
|
| 37 | { |
|
| 38 | $this->employee = $employee; |
|
| 39 | $this->employee_supervisor = $employee_supervisor; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Save the Profile - ReportsTo. |
|
| 44 | * |
|
| 45 | * @SWG\Post( |
|
| 46 | * path="/profile/supervisors", |
|
| 47 | * tags={"Employee Profiles"}, |
|
| 48 | * consumes={"application/json"}, |
|
| 49 | * summary="Save the Profile - ReportsTo.", |
|
| 50 | * @SWG\Response(response="201", description="Success", |
|
| 51 | * @SWG\Schema( |
|
| 52 | * title="data", |
|
| 53 | * type="object", |
|
| 54 | * required={"supervisor", "message", "status_code"}, |
|
| 55 | * @SWG\Property(property="employee", ref="#/definitions/Employee"), |
|
| 56 | * @SWG\Property(property="message", type="string", default="Record successfully added.", description="Status message from server"), |
|
| 57 | * @SWG\Property(property="status_code", type="integer", default=201, description="Status code from server"), |
|
| 58 | * ) |
|
| 59 | * ), |
|
| 60 | * @SWG\Response(response="400", description="Token not provided", |
|
| 61 | * @SWG\Schema( |
|
| 62 | * title="data", |
|
| 63 | * type="object", |
|
| 64 | * required={"message", "status_code", "debug"}, |
|
| 65 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 66 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 67 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 68 | * ) |
|
| 69 | * ), |
|
| 70 | * @SWG\Response(response="422", description="Unable to add record to the database.", |
|
| 71 | * @SWG\Schema( |
|
| 72 | * title="data", |
|
| 73 | * type="object", |
|
| 74 | * required={"message", "status_code"}, |
|
| 75 | * @SWG\Property(property="message", type="string", default="Unable to add record to the database.", description="Status message from server"), |
|
| 76 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 77 | * ) |
|
| 78 | * ), |
|
| 79 | * @SWG\Parameter( |
|
| 80 | * name="supervisor", |
|
| 81 | * in="body", |
|
| 82 | * required=true, |
|
| 83 | * @SWG\Property(ref="#/definitions/Employee") |
|
| 84 | * ), |
|
| 85 | * @SWG\Parameter( |
|
| 86 | * name="Authorization", |
|
| 87 | * in="header", |
|
| 88 | * description="JWT Token", |
|
| 89 | * required=true, |
|
| 90 | * type="string", |
|
| 91 | * default="Bearer " |
|
| 92 | * ), |
|
| 93 | * ) |
|
| 94 | * |
|
| 95 | * @param ReportsToRequest $request |
|
| 96 | * |
|
| 97 | * @return \Dingo\Api\Http\Response |
|
| 98 | * |
|
| 99 | * @author Bertrand Kintanar <[email protected]> |
|
| 100 | */ |
|
| 101 | public function store(ReportsToRequest $request) |
|
| 102 | { |
|
| 103 | return $this->storeModel($request, $this->employee_supervisor, 'supervisor'); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Update the Profile - ReportsTo. |
|
| 108 | * |
|
| 109 | * @SWG\Patch( |
|
| 110 | * path="/profile/supervisors", |
|
| 111 | * tags={"Employee Profiles"}, |
|
| 112 | * consumes={"application/json"}, |
|
| 113 | * summary="Update the Profile - ReportsTo.", |
|
| 114 | * @SWG\Response(response="200", description="Success", |
|
| 115 | * @SWG\Schema( |
|
| 116 | * title="data", |
|
| 117 | * type="object", |
|
| 118 | * required={"message", "status_code"}, |
|
| 119 | * @SWG\Property(property="message", type="string", default="Record successfully updated.", description="Status message from server"), |
|
| 120 | * @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"), |
|
| 121 | * ) |
|
| 122 | * ), |
|
| 123 | * @SWG\Response(response="400", description="Token not provided", |
|
| 124 | * @SWG\Schema( |
|
| 125 | * title="data", |
|
| 126 | * type="object", |
|
| 127 | * required={"message", "status_code", "debug"}, |
|
| 128 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 129 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 130 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 131 | * ) |
|
| 132 | * ), |
|
| 133 | * @SWG\Response(response="404", description="Unable to retrieve record from database.", |
|
| 134 | * @SWG\Schema( |
|
| 135 | * title="data", |
|
| 136 | * type="object", |
|
| 137 | * required={"message", "status_code", "debug"}, |
|
| 138 | * @SWG\Property(property="message", type="string", default="Unable to retrieve record from database.", description="Error message from server"), |
|
| 139 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 140 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 141 | * ) |
|
| 142 | * ), |
|
| 143 | * @SWG\Response(response="422", description="Unable to update record.", |
|
| 144 | * @SWG\Schema( |
|
| 145 | * title="data", |
|
| 146 | * type="object", |
|
| 147 | * required={"message", "status_code"}, |
|
| 148 | * @SWG\Property(property="message", type="string", default="Unable to update record.", description="Status message from server"), |
|
| 149 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 150 | * ) |
|
| 151 | * ), |
|
| 152 | * @SWG\Parameter( |
|
| 153 | * name="supervisor", |
|
| 154 | * in="body", |
|
| 155 | * required=true, |
|
| 156 | * description="employee's supervisor object that needs to be updated", |
|
| 157 | * @SWG\Property(ref="#/definitions/Employee") |
|
| 158 | * ), |
|
| 159 | * @SWG\Parameter( |
|
| 160 | * name="Authorization", |
|
| 161 | * in="header", |
|
| 162 | * description="JWT Token", |
|
| 163 | * required=true, |
|
| 164 | * type="string", |
|
| 165 | * default="Bearer " |
|
| 166 | * ), |
|
| 167 | * ) |
|
| 168 | * |
|
| 169 | * @param ReportsToRequest $request |
|
| 170 | * |
|
| 171 | * @return \Dingo\Api\Http\Response |
|
| 172 | * |
|
| 173 | * @author Bertrand Kintanar <[email protected]> |
|
| 174 | */ |
|
| 175 | public function update(ReportsToRequest $request) |
|
| 176 | { |
|
| 177 | return $this->updateModel($request, $this->employee_supervisor); |
|
| 178 | } |
|
| 179 | ||
| 180 | /** |
|
| 181 | * Delete the Profile - ReportsTo. |
|
| 182 | * |
|
| 183 | * @SWG\Delete( |
|
| 184 | * path="/profile/supervisors", |
|
| 185 | * tags={"Employee Profiles"}, |
|
| 186 | * consumes={"application/json"}, |
|
| 187 | * summary="Delete the Profile - ReportsTo.", |
|
| 188 | * @SWG\Response(response="200", description="Success", |
|
| 189 | * @SWG\Schema( |
|
| 190 | * title="data", |
|
| 191 | * type="object", |
|
| 192 | * required={"message", "status_code"}, |
|
| 193 | * @SWG\Property(property="message", type="string", default="Record successfully deleted.", description="Status message from server"), |
|
| 194 | * @SWG\Property(property="status_code", type="integer", default=200, description="Status code from server"), |
|
| 195 | * ) |
|
| 196 | * ), |
|
| 197 | * @SWG\Response(response="400", description="Token not provided", |
|
| 198 | * @SWG\Schema( |
|
| 199 | * title="data", |
|
| 200 | * type="object", |
|
| 201 | * required={"message", "status_code", "debug"}, |
|
| 202 | * @SWG\Property(property="message", type="string", default="Token not provided", description="Error message from server"), |
|
| 203 | * @SWG\Property(property="status_code", type="integer", default=400, description="Status code from server"), |
|
| 204 | * @SWG\Property(property="debug", type="object", description="Debug back trace"), |
|
| 205 | * ) |
|
| 206 | * ), |
|
| 207 | * @SWG\Response(response="422", description="Unable to delete record from the database.", |
|
| 208 | * @SWG\Schema( |
|
| 209 | * title="data", |
|
| 210 | * type="object", |
|
| 211 | * required={"message", "status_code"}, |
|
| 212 | * @SWG\Property(property="message", type="string", default="Unable to delete record from the database.", description="Status message from server"), |
|
| 213 | * @SWG\Property(property="status_code", type="integer", default=422, description="Status code from server"), |
|
| 214 | * ) |
|
| 215 | * ), |
|
| 216 | * @SWG\Parameter( |
|
| 217 | * name="id", |
|
| 218 | * in="formData", |
|
| 219 | * description="Employee's supervisor id to be deleted", |
|
| 220 | * required=true, |
|
| 221 | * type="integer", |
|
| 222 | * format="int64", |
|
| 223 | * default=1, |
|
| 224 | * ), |
|
| 225 | * @SWG\Parameter( |
|
| 226 | * name="Authorization", |
|
| 227 | * in="header", |
|
| 228 | * description="JWT Token", |
|
| 229 | * required=true, |
|
| 230 | * type="string", |
|
| 231 | * default="Bearer " |
|
| 232 | * ), |
|
| 233 | * ) |
|
| 234 | * |
|
| 235 | * @param ReportsToRequest $request |
|
| 236 | * |
|
| 237 | * @return \Dingo\Api\Http\Response |
|
| 238 | * |
|
| 239 | * @author Bertrand Kintanar <[email protected]> |
|
| 240 | */ |
|
| 241 | public function destroy(ReportsToRequest $request) |
|
| 242 | { |
|
| 243 | return $this->destroyModel($request, $this->employee_supervisor); |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||