refac: 변경한 DTO에 따라 코드 수정
- Spatie/DataTransferObject 대비
- MapFrom,MapTo -> RawName
- Strict -> 항상
- 심지어 raw type도 더 까다롭게
- array에 MapConverter 적용
- NullIsUndefined 적용
- 빈 nullable arg자리에 null 강제 지정
- Vue3에 v-model.number 지정
- input type="number" 기준
This commit is contained in:
+11
-16
@@ -2,23 +2,18 @@
|
||||
|
||||
namespace sammo\DTO;
|
||||
|
||||
use Spatie\DataTransferObject\Attributes\CastWith;
|
||||
use Spatie\DataTransferObject\Attributes\Strict;
|
||||
use Spatie\DataTransferObject\DataTransferObject;
|
||||
use Spatie\DataTransferObject\Casters\ArrayCaster;
|
||||
|
||||
//https://json2dto.atymic.dev/
|
||||
|
||||
#[Strict]
|
||||
class VoteInfo extends DataTransferObject
|
||||
class VoteInfo extends DTO
|
||||
{
|
||||
public int $id;
|
||||
public string $title;
|
||||
public int $multipleOptions;
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public string $title,
|
||||
public int $multipleOptions,
|
||||
|
||||
public string $startDate;
|
||||
public ?string $endDate;
|
||||
public string $startDate,
|
||||
public ?string $endDate,
|
||||
|
||||
/** @var string[] */
|
||||
public array $options;
|
||||
/** @var string[] */
|
||||
public array $options,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user