-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
todo.model.ts
46 lines (37 loc) · 954 Bytes
/
todo.model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// 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 {belongsTo, Entity, model, property} from '@loopback/repository';
import {TodoList, TodoListWithRelations} from './todo-list.model';
@model()
export class Todo extends Entity {
@property({
type: 'number',
id: true,
generated: false,
})
id?: number;
@property({
type: 'string',
required: true,
})
title: string;
@property({
type: 'string',
})
desc?: string;
@property({
type: 'boolean',
})
isComplete?: boolean;
@belongsTo(() => TodoList)
todoListId: number;
constructor(data?: Partial<Todo>) {
super(data);
}
}
export interface TodoRelations {
todoList?: TodoListWithRelations;
}
export type TodoWithRelations = Todo & TodoRelations;