chore: remove indokargo resync data feature

v2.0.0
ricky rx 1 year ago
parent b6e3edecde
commit 363f11136e

@ -174,11 +174,14 @@ class NewTvRequest extends Model {
$newTvReq->activated_at = now(); $newTvReq->activated_at = now();
$newTvReq->tv_fk = $tv->id; $newTvReq->tv_fk = $tv->id;
$newTvReq->save(); $newTvReq->save();
// try to sys_to_sys with indokargo
$jsonResponse = Indokargo::createTVAddress($tvRequest, $tv->id);
DB::commit(); DB::commit();
return $jsonResponse; return JSONResponse::Success(['message'=>'Success to update tv data']);
// TODO: waiting execution until update from ops
// // try to sys_to_sys with indokargo
// DB::commit();
// $jsonResponse = Indokargo::createTVAddress($tvRequest, $tv->id);
// return $jsonResponse;
} catch(\Throwable $th) { } catch(\Throwable $th) {
DB::rollback(); DB::rollback();
throw $th; throw $th;

@ -45,29 +45,6 @@ class Tv extends Model {
//------------------------------------------------------------ //------------------------------------------------------------
// -- RELATED TO REQUEST // -- RELATED TO REQUEST
public static function modifyAndValidateUpsertRequest(Request $request, $isUpdate = false) {
if($request->code) $request->merge(['code' => strtoupper($request->code)]);
$validationRules = [
'code' => ['required','string',Rule::unique('tvs', 'code')
->when($request->id, function($q, $id) {
$q->whereNot('id', $id);
})],
'col1' => 'nullable|string',
'col2' => 'nullable|string',
'col3' => 'nullable|string',
'col4' => 'nullable|string',
'col5' => 'nullable|string',
'col6' => 'nullable|string',
'col7' => 'nullable|string',
'col8' => 'nullable|string',
'col9' => 'nullable|string',
'col10' => 'nullable|string',
'notes' => 'nullable|string',
];
if($isUpdate) $validationRules['id'] = 'nullable|integer|exists:App\Models\Tv';
$request->validate();
return $request;
}
public static function updateFromRequest(Request $request) { public static function updateFromRequest(Request $request) {
if($request->code) $request->merge(['code' => strtoupper($request->code)]); if($request->code) $request->merge(['code' => strtoupper($request->code)]);
$request->validate([ $request->validate([
@ -106,10 +83,13 @@ class Tv extends Model {
$tv->notes = $request->notes; $tv->notes = $request->notes;
$tv->update(); $tv->update();
// try to sys_to_sys with indokargo return JSONResponse::Success(['message'=>'Success to update tv data']);
$jsonResponse = Indokargo::updateTVAddress($request, $tv->id, $tv->ik_address_id);
DB::commit(); // TODO: waiting from ops workflow
return $jsonResponse; // // try to sys_to_sys with indokargo
// $jsonResponse = Indokargo::updateTVAddress($request, $tv->id, $tv->ik_address_id);
// DB::commit();
// return $jsonResponse;
} catch(\Throwable $th) { } catch(\Throwable $th) {
DB::rollback(); DB::rollback();
throw $th; throw $th;
@ -123,12 +103,14 @@ class Tv extends Model {
$tv = Tv::findOrFail($request->id); $tv = Tv::findOrFail($request->id);
$tv->is_active = !$tv->is_active; $tv->is_active = !$tv->is_active;
$tv->save(); $tv->save();
return JSONResponse::Success(['message'=>'Success to change tv status']);
// try to sys_to_sys with indokargo // TODO: waiting from ops workflow
$jsonResponse = Indokargo::changeStatusAddress(new Request(['is_active' => $tv->is_active]), // // try to sys_to_sys with indokargo
$tv->id, $tv->ik_address_id); // $jsonResponse = Indokargo::changeStatusAddress(new Request(['is_active' => $tv->is_active]),
DB::commit(); // $tv->id, $tv->ik_address_id);
return $jsonResponse; // DB::commit();
// return $jsonResponse;
} catch(\Throwable $th) { } catch(\Throwable $th) {
DB::rollback(); DB::rollback();
throw $th; throw $th;

Loading…
Cancel
Save