Merge branch 'feat/wiki' into 'main'

Feat/wiki

See merge request jjimenez/safekat!581
This commit is contained in:
Alvaro
2025-03-02 09:25:35 +00:00
54 changed files with 14061 additions and 7 deletions

View File

@ -0,0 +1,58 @@
<?php
namespace App\Models\Wiki;
use App\Entities\Wiki\WikiContentEntity;
use CodeIgniter\Model;
class WikiContentModel extends Model
{
protected $table = 'wiki_contents';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = WikiContentEntity::class;
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
"locale",
"page_id",
"editor_data",
"published_data",
"last_edit_by",
"published_by",
"published_at"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Models\Wiki;
use App\Entities\Wiki\WikiFileEntity;
use CodeIgniter\Model;
class WikiFileModel extends Model
{
protected $table = 'wiki_files';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = WikiFileEntity::class;
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
"content_id",
"path"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Models\Wiki;
use App\Entities\Wiki\WikiPageEntity;
use CodeIgniter\Model;
class WikiPageModel extends Model
{
protected $table = 'wiki_pages';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = WikiPageEntity::class;
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
"section_id",
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Models\Wiki;
use App\Entities\Wiki\WikiSectionEntity;
use CodeIgniter\Model;
class WikiSectionModel extends Model
{
protected $table = 'wiki_sections';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = WikiSectionEntity::class;
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
"name",
"slug",
"icon",
"order",
"parent_id"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
/**
* Get wiki sections
*
* @return array<WikiSectionEntity>
*/
public function sections() : array
{
return $this->orderBy('order','asc')->findAll();
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Models\Wiki;
use App\Entities\Wiki\WikiSectionRoleEntity;
use CodeIgniter\Model;
class WikiSectionRoleModel extends Model
{
protected $table = 'wiki_section_roles';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = WikiSectionRoleEntity::class;
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
"wiki_section_id",
"role"
];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}