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:
@@ -2,32 +2,28 @@
|
||||
|
||||
namespace sammo\DTO;
|
||||
|
||||
use Spatie\DataTransferObject\Attributes\MapFrom;
|
||||
use Spatie\DataTransferObject\Attributes\MapTo;
|
||||
use Spatie\DataTransferObject\Attributes\Strict;
|
||||
use Spatie\DataTransferObject\DataTransferObject;
|
||||
use sammo\DTO\Attr\NullIsUndefined;
|
||||
use sammo\DTO\Attr\RawName;
|
||||
|
||||
#[Strict]
|
||||
class BettingItem extends DataTransferObject
|
||||
class BettingItem extends DTO
|
||||
{
|
||||
#[MapFrom('id')]
|
||||
#[MapTo('id')]
|
||||
public null|int $rowID = null;
|
||||
public function __construct(
|
||||
#[RawName('id')]
|
||||
#[NullIsUndefined]
|
||||
public ?int $rowID,
|
||||
|
||||
#[MapFrom('betting_id')]
|
||||
#[MapTo('betting_id')]
|
||||
public int $bettingID;
|
||||
#[RawName('betting_id')]
|
||||
public int $bettingID,
|
||||
|
||||
#[MapFrom('general_id')]
|
||||
#[MapTo('general_id')]
|
||||
public int $generalID;
|
||||
#[RawName('general_id')]
|
||||
public int $generalID,
|
||||
|
||||
#[MapFrom('user_id')]
|
||||
#[MapTo('user_id')]
|
||||
public null|int $userID;
|
||||
#[RawName('user_id')]
|
||||
public ?int $userID,
|
||||
|
||||
#[MapFrom('betting_type')]
|
||||
#[MapTo('betting_type')]
|
||||
public string $bettingType;
|
||||
public int $amount;
|
||||
#[RawName('betting_type')]
|
||||
public string $bettingType,
|
||||
public int $amount,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user