Skip to content

Commit

Permalink
feat: immutable_datetime only for read-only fields
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoNegro committed Aug 24, 2022
1 parent b818093 commit c650940
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import isFieldUuid from '../helpers/is-field-uuid';
import isFieldEnum from '../helpers/is-field-enum';
import getTableNameFromModel from '../helpers/get-table-name-from-model';
import getEnumFqcn from '../helpers/get-enum-fqcn';
import isFieldReadOnly from '../helpers/is-field-read-only';

const getCastAndRulesFromField = (
field: DMMF.Field,
Expand Down Expand Up @@ -133,7 +134,7 @@ const getCastAndRulesFromField = (
});
break;
case 'DateTime':
cast.value = 'immutable_datetime';
cast.value = isFieldReadOnly(field) ? 'immutable_datetime' : 'datetime';
rules.push({
value: 'date',
isMethodCall: false,
Expand Down

0 comments on commit c650940

Please sign in to comment.