瀏覽代碼

fixed date initDbo; fixed lu notification business

tags/v0.6.0
Robin Thoni 7 年之前
父節點
當前提交
292a418d32
共有 2 個檔案被更改,包括 11 行新增9 行删除
  1. 7
    7
      src/Business/lu-notifications-business.js
  2. 4
    2
      src/DataAccess/lu-webapi-crud-dataaccess.js

+ 7
- 7
src/Business/lu-notifications-business.js 查看文件

@@ -15,22 +15,22 @@
15 15
 
16 16
             luNotificationsBusiness.EVENT_DELETE = 'EVENT_DELETE';
17 17
 
18
-            luNotificationsBusiness.businesses = {};
18
+            luNotificationsBusiness.dataAccesses = {};
19 19
 
20 20
 
21 21
             function callbackWrapper(callback) {
22 22
                 return function (eventName, entityType, oldEntity, newEntity) {
23
-                    var business = luNotificationsBusiness.businesses[entityType];
24
-                    if (business != null && business.initDbo != null) {
25
-                        oldEntity = business.initDbo(oldEntity);
26
-                        newEntity = business.initDbo(newEntity);
23
+                    var dataAccess = luNotificationsBusiness.dataAccesses[entityType];
24
+                    if (dataAccess != null && dataAccess.initDbo != null) {
25
+                        oldEntity = dataAccess.initDbo(oldEntity, dataAccess.TYPE_MODEL);
26
+                        newEntity = dataAccess.initDbo(newEntity, dataAccess.TYPE_MODEL);
27 27
                     }
28 28
                     return callback(eventName, entityType, oldEntity, newEntity);
29 29
                 };
30 30
             }
31 31
 
32
-            luNotificationsBusiness.init = function (businesses) {
33
-                luNotificationsBusiness.businesses = businesses;
32
+            luNotificationsBusiness.init = function (dataAccesses) {
33
+                luNotificationsBusiness.dataAccesses = dataAccesses;
34 34
                 luNotificationsDataAccess.init();
35 35
             };
36 36
 

+ 4
- 2
src/DataAccess/lu-webapi-crud-dataaccess.js 查看文件

@@ -67,8 +67,10 @@
67 67
                         return null;
68 68
                     }
69 69
                     var dbo = DataAccess.extendDeep({}, angular.copy(DataAccess.defaultDbo), model);
70
-                    dbo.createdAt = luUtilsDataAccess.stringToMomentDateTime(dbo.createdAt);
71
-                    dbo.updatedAt = luUtilsDataAccess.stringToMomentDateTime(dbo.updatedAt);
70
+                    if (type == DataAccess.TYPE_MODEL) {
71
+                        dbo.createdAt = luUtilsDataAccess.stringToMomentDateTime(dbo.createdAt);
72
+                        dbo.updatedAt = luUtilsDataAccess.stringToMomentDateTime(dbo.updatedAt);
73
+                    }
72 74
                     return dbo;
73 75
                 };
74 76
 

Loading…
取消
儲存