ch-a-os / DocSort

Digitize and access everything, everywhere.
GNU General Public License v3.0
0 stars 1 forks source link

Replace interfaces with real classes #143

Open ghost opened 5 years ago

ghost commented 5 years ago

Data that isn't coming from some external API but is created within the code itself, should not use interfaces but real classes.

Example:

interface ISearchData {
  title?: string;
  note?: string;
  primaryNumber?: string;
  secondaryNumber?: string;
  textRecognitionEnabled?: boolean;
  isInGroup?: boolean;
  dateFrom?: Date;
  dateTo?: Date;
  tags?: Array<string>;
}

When we switch to creating a real class for the object, the object itself can manage its status... For example the primary and secondary number can never be negative, or the order of dateFrom and dateTo needs to be consistent.