update model test

This commit is contained in:
mahdahar 2025-11-19 15:35:32 +07:00
parent fc990ffa81
commit cc0c47510d
7 changed files with 22 additions and 22 deletions

View File

@ -34,7 +34,7 @@ class TestDef extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
try {
$id = $this->model->insert($input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}
@ -47,7 +47,7 @@ class TestDef extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
try {
$this->model->update($id,$input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}

View File

@ -34,7 +34,7 @@ class TestDefCal extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
try {
$id = $this->model->insert($input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data' => $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}
@ -47,7 +47,7 @@ class TestDefCal extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
try {
$this->model->update($id,$input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data' => $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}

View File

@ -39,7 +39,7 @@ class TestDefSite extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
try {
$id = $this->model->insert($input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data' => $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}
@ -52,7 +52,7 @@ class TestDefSite extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
try {
$this->model->update($id,$input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}

View File

@ -34,7 +34,7 @@ class TestDefTech extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
try {
$id = $this->model->insert($input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}
@ -47,7 +47,7 @@ class TestDefTech extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
try {
$this->model->update($id,$input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}

View File

@ -34,7 +34,7 @@ class TestGrp extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
try {
$id = $this->model->insert($input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}
@ -47,7 +47,7 @@ class TestGrp extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
try {
$this->model->update($id,$input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}

View File

@ -34,7 +34,7 @@ class TestMap extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
try {
$id = $this->model->insert($input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data' => $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}
@ -47,7 +47,7 @@ class TestMap extends BaseController {
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
try {
$this->model->update($id,$input);
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data' => $id ]);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
}

View File

@ -15,7 +15,7 @@ class CreateTestsTable extends Migration {
'DisciplineID' => ['type' => 'INT', 'null' => false],
'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true],
'Seq' => ['type' => 'int', 'constraint'=> 15, 'null' => true],
'CountStat' => ['type' => 'int' ],
'CountStat' => ['type' => 'int', 'null' => true ],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],
]);
@ -29,12 +29,12 @@ class CreateTestsTable extends Migration {
'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false],
'Type' => ['type' => 'int', 'null' => false],
'Description' => ['type' => 'varchar', 'constraint'=> 150, 'null' => true],
'SeqScr' => ['type' => 'int', 'null' => false],
'SeqRpt' => ['type' => 'int', 'null' => false],
'IndentLeft' => ['type' => 'int', 'null' => false],
'VisibleScr' => ['type' => 'int', 'null' => false],
'VisibleRpt' => ['type' => 'int', 'null' => false],
'CountStat' => ['type' => 'int', 'null' => false],
'SeqScr' => ['type' => 'int', 'null' => true],
'SeqRpt' => ['type' => 'int', 'null' => true],
'IndentLeft' => ['type' => 'int', 'null' => true],
'VisibleScr' => ['type' => 'int', 'null' => true],
'VisibleRpt' => ['type' => 'int', 'null' => true],
'CountStat' => ['type' => 'int', 'null' => true],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true],
]);
@ -44,7 +44,7 @@ class CreateTestsTable extends Migration {
$this->forge->addField([
'TestTechID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'SiteID' => ['type' => 'INT', 'null' => true],
'TestSiteID' => ['type' => 'INT', 'null' => true],
'TestSiteID' => ['type' => 'INT', 'null' => false],
'DisciplineID' => ['type' => 'int', 'null' => true],
'DepartmentID' => ['type' => 'int', 'null' => true],
'WorkstationID' => ['type' => 'int', 'null' => true],
@ -69,7 +69,7 @@ class CreateTestsTable extends Migration {
$this->forge->addField([
'TestCalID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'SiteID' => ['type' => 'INT', 'null' => true],
'TestSiteID' => ['type' => 'INT', 'null' => true],
'TestSiteID' => ['type' => 'INT', 'null' => false],
'DisciplineID' => ['type' => 'INT', 'null' => true],
'DepartmentID' => ['type' => 'INT', 'null' => true],
'FormulaCode' => ['type' => 'varchar', 'constraint'=>150, 'null' => true],
@ -87,7 +87,7 @@ class CreateTestsTable extends Migration {
$this->forge->addField([
'TestGrpID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
'SiteID' => ['type' => 'INT', 'null' => true],
'TestSiteID' => ['type' => 'INT', 'null' => true],
'TestSiteID' => ['type' => 'INT', 'null' => false],
'Member' => ['type' => 'INT', 'null' => true],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'Datetime', 'null' => true]