Skip to content

Commit

Permalink
ci: update code coverage and simplify phone number validation (#533)
Browse files Browse the repository at this point in the history
* ci: update code coverage and simplify phone number validation

- Update .gitignore to include tests/coverage directory
- Modify GitHub Actions workflow to use correct coverage file path
- Remove regex validation for phone number in UserRequest

* Apply cs fix

* refactor(web): remove deleted_at field from log interface

- Removed 'deleted_at' property from the log interface in TypeScript
- Updated the PHP controller to reflect this change in the API response example
  • Loading branch information
zds-s authored Jan 15, 2025
1 parent 4c7cbb0 commit b4d9213
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/Http/Admin/Controller/PermissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
)]
#[PageResponse(
instance: MenuSchema::class,
example: '{"code":200,"message":"成功","data":[{"id":290,"parent_id":0,"name":"LAme6dFrlf","code":"eNiYagCtJp","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[{"id":291,"parent_id":290,"name":"zFFsqwN3rB","code":"isz4eTJANV","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]},{"id":291,"parent_id":290,"name":"zFFsqwN3rB","code":"isz4eTJANV","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]},{"id":292,"parent_id":0,"name":"mMMSlHc8cv","code":"xzobstyEmP","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[{"id":293,"parent_id":292,"name":"8Sr5vtPSqw","code":"9SelwHGooE","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]},{"id":293,"parent_id":292,"name":"8Sr5vtPSqw","code":"9SelwHGooE","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]},{"id":294,"parent_id":0,"name":"ot8fL3u7QZ","code":"kCbrLhgYDj","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[{"id":295,"parent_id":294,"name":"6uQFNiMzJa","code":"GVvC2iPU92","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]},{"id":295,"parent_id":294,"name":"6uQFNiMzJa","code":"GVvC2iPU92","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]}'
example: '{"code":200,"message":"成功","data":[{"id":290,"parent_id":0,"name":"LAme6dFrlf","code":"eNiYagCtJp","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","remark":"test","children":[{"id":291,"parent_id":290,"name":"zFFsqwN3rB","code":"isz4eTJANV","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]},{"id":291,"parent_id":290,"name":"zFFsqwN3rB","code":"isz4eTJANV","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]},{"id":292,"parent_id":0,"name":"mMMSlHc8cv","code":"xzobstyEmP","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[{"id":293,"parent_id":292,"name":"8Sr5vtPSqw","code":"9SelwHGooE","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]},{"id":293,"parent_id":292,"name":"8Sr5vtPSqw","code":"9SelwHGooE","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]},{"id":294,"parent_id":0,"name":"ot8fL3u7QZ","code":"kCbrLhgYDj","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[{"id":295,"parent_id":294,"name":"6uQFNiMzJa","code":"GVvC2iPU92","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]},{"id":295,"parent_id":294,"name":"6uQFNiMzJa","code":"GVvC2iPU92","icon":"test","route":"test","component":"test","redirect":"test","is_hidden":1,"type":"M","status":1,"sort":1,"created_by":1,"updated_by":1,"created_at":"2024-08-02 00:32:26","updated_at":"2024-08-02 00:32:26","deleted_at":null,"remark":"test","children":[]}]}'
)]
public function menus(): Result
{
Expand Down
5 changes: 2 additions & 3 deletions app/Model/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* @property int $updated_by 更新者
* @property Carbon $created_at 创建时间
* @property Carbon $updated_at 更新时间
* @property Carbon $deleted_at 删除时间
* @property string $remark 备注
*/
final class Attachment extends MineModel
Expand All @@ -44,10 +43,10 @@ final class Attachment extends MineModel
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['id', 'storage_mode', 'origin_name', 'object_name', 'hash', 'mime_type', 'storage_path', 'suffix', 'size_byte', 'size_info', 'url', 'created_by', 'updated_by', 'created_at', 'updated_at', 'deleted_at', 'remark'];
protected array $fillable = ['id', 'storage_mode', 'origin_name', 'object_name', 'hash', 'mime_type', 'storage_path', 'suffix', 'size_byte', 'size_info', 'url', 'created_by', 'updated_by', 'created_at', 'updated_at', 'remark'];

/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'storage_mode' => 'integer', 'size_byte' => 'integer', 'created_by' => 'integer', 'updated_by' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime'];
protected array $casts = ['id' => 'integer', 'storage_mode' => 'integer', 'size_byte' => 'integer', 'created_by' => 'integer', 'updated_by' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
}
4 changes: 2 additions & 2 deletions app/Model/Permission/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ final class User extends Model
* 隐藏的字段列表.
* @var string[]
*/
protected array $hidden = ['password', 'deleted_at'];
protected array $hidden = ['password'];

/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['id', 'username', 'password', 'user_type', 'nickname', 'phone', 'email', 'avatar', 'signed', 'status', 'login_ip', 'login_time', 'backend_setting', 'created_by', 'updated_by', 'created_at', 'updated_at', 'deleted_at', 'remark'];
protected array $fillable = ['id', 'username', 'password', 'user_type', 'nickname', 'phone', 'email', 'avatar', 'signed', 'status', 'login_ip', 'login_time', 'backend_setting', 'created_by', 'updated_by', 'created_at', 'updated_at', 'remark'];

/**
* The attributes that should be cast to native types.
Expand Down
3 changes: 0 additions & 3 deletions app/Repository/Logstash/UserOperationLogRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public function handleSearch(Builder $query, array $params): Builder
})
->when(Arr::get($params, 'updated_at'), static function (Builder $query, $updated_at) {
$query->whereBetween('updated_at', $updated_at);
})
->when(Arr::get($params, 'deleted_at'), static function (Builder $query, $deleted_at) {
$query->whereBetween('deleted_at', $deleted_at);
});
}
}
6 changes: 1 addition & 5 deletions app/Schema/AttachmentSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ final class AttachmentSchema implements \JsonSerializable
#[Property(property: 'updated_at', title: '', type: 'mixed')]
public mixed $updatedAt;

#[Property(property: 'deleted_at', title: '', type: 'mixed')]
public mixed $deletedAt;

#[Property(property: 'remark', title: '备注', type: 'string')]
public ?string $remark;

Expand All @@ -87,12 +84,11 @@ public function __construct(Attachment $model)
$this->updatedBy = $model->updated_by;
$this->createdAt = $model->created_at;
$this->updatedAt = $model->updated_at;
$this->deletedAt = $model->deleted_at;
$this->remark = $model->remark;
}

public function jsonSerialize(): mixed
{
return ['id' => $this->id, 'storage_mode' => $this->storageMode, 'origin_name' => $this->originName, 'object_name' => $this->objectName, 'hash' => $this->hash, 'mime_type' => $this->mimeType, 'storage_path' => $this->storagePath, 'suffix' => $this->suffix, 'size_byte' => $this->sizeByte, 'size_info' => $this->sizeInfo, 'url' => $this->url, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'deleted_at' => $this->deletedAt, 'remark' => $this->remark];
return ['id' => $this->id, 'storage_mode' => $this->storageMode, 'origin_name' => $this->originName, 'object_name' => $this->objectName, 'hash' => $this->hash, 'mime_type' => $this->mimeType, 'storage_path' => $this->storagePath, 'suffix' => $this->suffix, 'size_byte' => $this->sizeByte, 'size_info' => $this->sizeInfo, 'url' => $this->url, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'remark' => $this->remark];
}
}
6 changes: 1 addition & 5 deletions app/Schema/RoleSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ final class RoleSchema implements \JsonSerializable
#[Property(property: 'updated_at', title: '', type: 'string')]
public string $updatedAt;

#[Property(property: 'deleted_at', title: '', type: 'string')]
public string $deletedAt;

#[Property(property: 'remark', title: '备注', type: 'string')]
public ?string $remark;

Expand All @@ -68,12 +65,11 @@ public function __construct(Role $model)
$this->updatedBy = $model->updated_by;
$this->createdAt = $model->created_at;
$this->updatedAt = $model->updated_at->format(CarbonInterface::DEFAULT_TO_STRING_FORMAT);
$this->deletedAt = $model->deleted_at->format(CarbonInterface::DEFAULT_TO_STRING_FORMAT);
$this->remark = $model->remark;
}

public function jsonSerialize(): mixed
{
return ['id' => $this->id, 'name' => $this->name, 'code' => $this->code, 'data_scope' => $this->dataScope, 'status' => $this->status, 'sort' => $this->sort, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'deleted_at' => $this->deletedAt, 'remark' => $this->remark];
return ['id' => $this->id, 'name' => $this->name, 'code' => $this->code, 'data_scope' => $this->dataScope, 'status' => $this->status, 'sort' => $this->sort, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'remark' => $this->remark];
}
}
6 changes: 1 addition & 5 deletions app/Schema/UserOperationLogSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ class UserOperationLogSchema implements \JsonSerializable
#[Property(property: 'updated_at', title: '更新时间', type: 'mixed')]
public mixed $updatedAt;

#[Property(property: 'deleted_at', title: '删除时间', type: 'mixed')]
public mixed $deletedAt;

#[Property(property: 'remark', title: '备注', type: 'string')]
public ?string $remark;

Expand All @@ -83,12 +80,11 @@ public function __construct(UserOperationLog $model)
$this->updatedBy = $model->updated_by;
$this->createdAt = $model->created_at;
$this->updatedAt = $model->updated_at;
$this->deletedAt = $model->deleted_at;
$this->remark = $model->remark;
}

public function jsonSerialize(): mixed
{
return ['id' => $this->id, 'username' => $this->username, 'method' => $this->method, 'router' => $this->router, 'service_name' => $this->serviceName, 'ip' => $this->ip, 'ip_location' => $this->ipLocation, 'request_data' => $this->requestData, 'response_code' => $this->responseCode, 'response_data' => $this->responseData, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'deleted_at' => $this->deletedAt, 'remark' => $this->remark];
return ['id' => $this->id, 'username' => $this->username, 'method' => $this->method, 'router' => $this->router, 'service_name' => $this->serviceName, 'ip' => $this->ip, 'ip_location' => $this->ipLocation, 'request_data' => $this->requestData, 'response_code' => $this->responseCode, 'response_data' => $this->responseData, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'remark' => $this->remark];
}
}
6 changes: 1 addition & 5 deletions app/Schema/UserSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ final class UserSchema implements \JsonSerializable
#[Property(property: 'updated_at', title: '更新时间', type: 'string')]
public mixed $updatedAt;

#[Property(property: 'deleted_at', title: '删除时间', type: 'string')]
public mixed $deletedAt;

#[Property(property: 'remark', title: '备注', type: 'string')]
public ?string $remark;

Expand All @@ -93,12 +90,11 @@ public function __construct(User $model)
$this->updatedBy = $model->updated_by;
$this->createdAt = $model->created_at;
$this->updatedAt = $model->updated_at;
$this->deletedAt = $model->deleted_at;
$this->remark = $model->remark;
}

public function jsonSerialize(): mixed
{
return ['id' => $this->id, 'username' => $this->username, 'user_type' => $this->userType, 'nickname' => $this->nickname, 'phone' => $this->phone, 'email' => $this->email, 'avatar' => $this->avatar, 'signed' => $this->signed, 'status' => $this->status, 'login_ip' => $this->loginIp, 'login_time' => $this->loginTime, 'backend_setting' => $this->backendSetting, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'deleted_at' => $this->deletedAt, 'remark' => $this->remark];
return ['id' => $this->id, 'username' => $this->username, 'user_type' => $this->userType, 'nickname' => $this->nickname, 'phone' => $this->phone, 'email' => $this->email, 'avatar' => $this->avatar, 'signed' => $this->signed, 'status' => $this->status, 'login_ip' => $this->loginIp, 'login_time' => $this->loginTime, 'backend_setting' => $this->backendSetting, 'created_by' => $this->createdBy, 'updated_by' => $this->updatedBy, 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, 'remark' => $this->remark];
}
}
1 change: 0 additions & 1 deletion storage/languages/en/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'updated_by ' => ' Updater ',
'created_at' => 'Creation time',
'updated_at ' => ' Update time ',
'deleted_at' => 'Delete time',
'Remark ' => ' Remark ',
'username_exist' => 'Username already exists',
'Enums' => [
Expand Down
1 change: 0 additions & 1 deletion storage/languages/zh_CN/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'updated_by' => '更新者',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'deleted_at' => '删除时间',
'remark' => '备注',
'username_exist' => '用户名已存在',
'enums' => [
Expand Down
1 change: 0 additions & 1 deletion storage/languages/zh_TW/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'updated_by' => '更新者',
'created_at' => '創建時間',
'updated_at' => '更新時間',
'deleted_at' => '刪除時間',
'remark' => '備註',
'username_exist' => '用戶名已存在',
'enums' => [
Expand Down
1 change: 0 additions & 1 deletion web/src/modules/base/api/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export interface RequestLogInfoVo {
ip: string
created_at: string
updated_at: string
deleted_at: string
// 备注信息
remark: string
}
Expand Down

0 comments on commit b4d9213

Please sign in to comment.