apps/nestjs-backend/src/features/field/model/field-dto/checkbox-field.dto.ts
import { CheckboxFieldCore } from '@teable/core';
import type { FieldBase } from '../field-base';
export class CheckboxFieldDto extends CheckboxFieldCore implements FieldBase {
get isStructuredCellValue() {
return false;
}
convertCellValue2DBValue(value: unknown): unknown {
if (this.isMultipleCellValue) {
return value == null ? value : JSON.stringify(value);
}
return value ? true : null;
}
convertDBValue2CellValue(value: unknown): unknown {
if (this.isMultipleCellValue) {
return value == null || typeof value === 'object' ? value : JSON.parse(value as string);
}
return value ? true : null;
}
}