This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
exercise.model.ts 1.59 KiB
Newer Older
import { Person } from 'app/shared/model/person.model';
import { SearchResultDTO } from 'app/shared/model/search/search-result-dto.model';

export enum IExerciseType {
  COLLECTION = 'collection',
  PROGRAMMING_EXERCISE = 'programming exercise',
  EXERCISE = 'exercise',
  OTHER = 'other',
}

Eduard Frankford's avatar
Eduard Frankford committed
export enum ILanguages {
  GERMAN = 'de',
  ENGLISH = 'en',
}

// just a cheap trick, to make enum available to HTML.
// see https://stackoverflow.com/questions/35835984/how-to-use-a-typescript-enum-value-in-an-angular2-ngswitch-statement
// export function IExerciseTypeAware(constructor: Function) {
//    constructor.prototype.IExerciseType = IExerciseType;
// }

// export class IExerciseTypeClass {
//     myEnum: typeof IExerciseType;
//     myEnumField: IExerciseType;
// }
export interface Exercise {
  // from metadata (required)
  license: string;

  // from metadata (optional)
  description: string;
  programmingLanguages: string[];
  languages: string[];
Daniel Rainer's avatar
Daniel Rainer committed
  creators: Person[];
  publisher: Person[];
  contributor: Person[];
  imageURL: string;
  timeRequired: string;
  deprecated: boolean;
  difficulty: string;
  educationLevel: string;
  format: Array<string>;
  keyword: Array<string>;
  // language: Array<string>;
  // repositoryURL: string;
  // source: Array<string>;
  // structure: string;
  // not in metadata
  rating: number;
  lastUpdate: Date;
  originalResult: SearchResultDTO;
  // thesis