teableio/teable

View on GitHub
apps/nestjs-backend/src/features/field/model/field-dto/multiple-select-field.dto.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { MultipleSelectFieldCore } from '@teable/core';
import type { FieldBase } from '../field-base';

export class MultipleSelectFieldDto extends MultipleSelectFieldCore implements FieldBase {
  get isStructuredCellValue() {
    return false;
  }

  convertCellValue2DBValue(value: unknown): string | null {
    return value == null ? null : JSON.stringify(value);
  }

  convertDBValue2CellValue(value: unknown): string[] {
    return value == null || typeof value === 'object' ? value : JSON.parse(value as string);
  }
}