• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { SysDefFolder, SysDefFolderUuid, FolderType, NoteType, Favorite, Top, Delete } from './EnumData';
17import relationalStore from '@ohos.data.relationalStore';
18
19interface DbInfoType {
20  db_name: DbNameType;
21  db_verison: number;
22}
23
24interface DbNameType {
25  name: string;
26  securityLevel: relationalStore.SecurityLevel;
27}
28
29class SysDefData {
30  /**
31   * db info
32   */
33  public dbInfo: DbInfoType = {
34    db_name: {
35      name: "note.db", // 数据库名称
36      securityLevel: relationalStore.SecurityLevel.S1
37    },
38    db_verison: 1 // 数据库版本
39  };
40
41  /**
42   * system defined folder
43   */
44  public sys_def_allNotes: relationalStore.ValuesBucket = {
45      "id": 1,
46      "name": SysDefFolder.AllNotes,
47      "uuid": SysDefFolderUuid.AllNotes,
48      "color": "#ffffff",
49      "folder_type": FolderType.SysDef,
50      "is_deleted": Delete.No,
51      "created_time": 1641863695000,
52      "modified_time": 1641863695000
53    };
54
55  public sys_def_unClassified: relationalStore.ValuesBucket = {
56      "id": 2,
57      "name": SysDefFolder.UnClassified,
58      "uuid": SysDefFolderUuid.UnClassified,
59      "color": "#ffffff",
60      "folder_type": FolderType.SysDef,
61      "is_deleted": Delete.No,
62      "created_time": 1641860095000,
63      "modified_time": 1641860095000
64    };
65
66  public sys_def_myFavorites: relationalStore.ValuesBucket = {
67      "id": 3,
68      "name": SysDefFolder.MyFavorites,
69      "uuid": SysDefFolderUuid.MyFavorites,
70      "color": "#ffffff",
71      "folder_type": FolderType.FeatureDef,
72      "is_deleted": Delete.No,
73      "created_time": 1641856088000,
74      "modified_time": 1641856088000
75    };
76
77  public sys_def_recentDeletes: relationalStore.ValuesBucket = {
78      "id": 4,
79      "name": SysDefFolder.RecentDeletes,
80      "uuid": SysDefFolderUuid.RecentDeletes,
81      "color": "#ffffff",
82      "folder_type": FolderType.FeatureDef,
83      "is_deleted": Delete.No,
84      "created_time": 1641848898000,
85      "modified_time": 1641848898000
86    };
87
88  public sys_def_personal: relationalStore.ValuesBucket = {
89      "id": 5,
90      "name": "个人",
91      "uuid": SysDefFolderUuid.Personal,
92      "color": "#41ba41",
93      "folder_type": FolderType.CusDef,
94      "is_deleted": Delete.No,
95      "created_time": 1641677288000,
96      "modified_time": 1641677288000
97    };
98
99  public sys_def_life: relationalStore.ValuesBucket = {
100      "id": 6,
101      "name": "生活",
102      "uuid": SysDefFolderUuid.Life,
103      "color": "#00aaee",
104      "folder_type": FolderType.CusDef,
105      "is_deleted": Delete.No,
106      "created_time": 1641676108000,
107      "modified_time": 1641676108000
108    };
109
110  public sys_def_work: relationalStore.ValuesBucket = {
111      "id": 7,
112      "name": "工作",
113      "uuid": SysDefFolderUuid.Work,
114      "color": "#f86d05",
115      "folder_type": FolderType.CusDef,
116      "is_deleted": Delete.No,
117      "created_time": 1641636508000,
118      "modified_time": 1641636508000
119    };
120
121  /**
122   * system defined note
123   */
124  public sys_def_note1: relationalStore.ValuesBucket = {
125      "id": 1,
126      "title": "数学公式",
127      "uuid": "note1_uuid",
128      "folder_uuid": SysDefFolderUuid.UnClassified,
129      "content_text": '<text>好好学习,天天向上</text>',
130      "content_img": "",
131      "note_type": NoteType.SysDef,
132      "is_top": Top.Yes,
133      "is_favorite": Favorite.Yes,
134      "is_deleted": Delete.No,
135      "created_time": 1641869573000,
136      "modified_time": 1641869573000,
137      "deleted_time": 0,
138      "slider_value": 0
139    };
140
141  public sys_def_note2: relationalStore.ValuesBucket = {
142      "id": 2,
143      "title": "UX会议纪要",
144      "uuid": "note2_uuid",
145      "folder_uuid": SysDefFolderUuid.Work,
146      "content_text": "",
147      "content_img": "",
148      "note_type": NoteType.SysDef,
149      "is_top": Top.Yes,
150      "is_favorite": Favorite.No,
151      "is_deleted": Delete.No,
152      "created_time": 1640999288000,
153      "modified_time": 1640999288000,
154      "deleted_time": 0,
155      "slider_value": 0
156    };
157
158  public sys_def_note3: relationalStore.ValuesBucket = {
159      "id": 3,
160      "title": "旅游心得",
161      "uuid": "note3_uuid",
162      "folder_uuid": SysDefFolderUuid.Work,
163      "content_text": '<div style="line-height:1.4;"><text>要想整个旅程无遗憾,关键是心态,首先要对即将到的目的地有一个正确的认识和恰当的期望。</text></div>',
164      "content_img": "",
165      "note_type": NoteType.SysDef,
166      "is_top": Top.No,
167      "is_favorite": Favorite.No,
168      "is_deleted": Delete.No,
169      "created_time": 1641385708000,
170      "modified_time": 1641385708000,
171      "deleted_time": 0,
172      "slider_value": 0
173    };
174
175  public sys_def_note4: relationalStore.ValuesBucket = {
176    "id": 4,
177    "title": "蛋糕做法",
178    "uuid": "note4_uuid",
179    "folder_uuid": SysDefFolderUuid.Life,
180    "content_text": '<span>&nbsp;</span>' +
181      '<input name="checkbox" type="checkbox" onclick="onCheckChange(this)" class="note-checkbox" checked="checked">' +
182      '<span style="line-height:22.4px;" class="note-checkbox-txt">糖60g</span><br>' +
183      '<span>&nbsp;</span>' +
184      '<input name="checkbox" type="checkbox" onclick="onCheckChange(this)" class="note-checkbox">' +
185      '<span style="line-height:22.4px;" class="note-checkbox-txt">玉米油40g</span><br><div>' +
186      '<div><text style="line-height:22.4px;">&nbsp;1.&nbsp;&nbsp;&nbsp;添加鸡蛋、盐、糖、蛋糕粉<br>' +
187      '&nbsp;2.&nbsp;&nbsp;&nbsp;加入玉米油、牛奶,烤箱预热15分钟<br>' +
188      '&nbsp;3.&nbsp;&nbsp;&nbsp;加入葡萄干、核桃仁,烤箱定时40分钟<br><br></text></div></div></div>',
189    "content_img": "",
190    "note_type": NoteType.CusDef,
191    "is_top": Top.No,
192    "is_favorite": Favorite.Yes,
193    "is_deleted": Delete.No,
194    "created_time": 1640909288000,
195    "modified_time": 1640909288000,
196    "deleted_time": 0,
197    "slider_value": 0
198  };
199}
200
201export default new SysDefData();