// Copyright IBM Corp. and LoopBack contributors 2018,2020. All Rights Reserved. // Node module: @loopback/example-todo-list // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT import {Entity, hasMany, hasOne, model, property} from '@loopback/repository'; import { TodoListImage, TodoListImageWithRelations, } from './todo-list-image.model'; import {Todo, TodoWithRelations} from './todo.model'; @model() export class TodoList extends Entity { @property({ type: 'number', id: true, generated: false, }) id?: number; @property({ type: 'string', required: true, }) title: string; @property({ type: 'string', }) color?: string; @hasMany(() => Todo) todos: Todo[]; @hasOne(() => TodoListImage) image: TodoListImage; constructor(data?: Partial) { super(data); } } export interface TodoListRelations { todos?: TodoWithRelations[]; image?: TodoListImageWithRelations; } export type TodoListWithRelations = TodoList & TodoListRelations;