@@ -33,23 +33,24 @@ const todosFacade = factory<TodoEntity>({
33
33
dbName: ' todoapp' ,
34
34
url: ' mongodb://localhost:27017' ,
35
35
}),
36
+ // Optional property to convert an entity to a DB document. Defaults to "utils/constructIdDocument".
36
37
constructDocument : ({ id , ... patch }) => {
37
- // Optional property that converts an entity to a document for the database.
38
38
return { _id: id , ... patch };
39
39
},
40
+ // Optional property to convert a DB document to an entity. Defaults to "utils/constructIdEntity".
40
41
constructEntity : ({ _id , ... document }) => {
41
- // Optional property that converts a document from the database to an entity.
42
42
return { id: _id , ... document };
43
43
},
44
+ // Optional property to convert an entity filter to a DB filter. Defaults to "utils/parseFilterId".
44
45
constructFilter : (filter ) => {
45
- // Optional property that converts an entity filter to a filter for the DB.
46
46
return parseFilterId (filter );
47
47
},
48
+ // Optional property to convert an entity sort to a DB sort. Defaults to "utils/renameSortId".
48
49
constructSort : (sort ) => {
49
- // Optional property that converts an entity sort to a sort for the DB.
50
50
return renameSortId (sort );
51
51
}.
52
- defaultPaginationLimit : 100 , // Optional property.
52
+ // Optional property. Defaults to 100.
53
+ defaultPaginationLimit : 100 ,
53
54
entityName: ' todo' ,
54
55
});
55
56
```
0 commit comments