add createMethod #2

Merged
lqhoang99 merged 4 commits from feature/createMethod into master 2021-11-05 09:28:06 +00:00
lqhoang99 commented 2021-11-05 07:22:46 +00:00 (Migrated from github.com)
No description provided.
namhq1989 (Migrated from github.com) reviewed 2021-11-05 07:42:34 +00:00
namhq1989 (Migrated from github.com) left a comment
  • module này không có quản lý việc generate token, nó nằm ở module UserManagement
  • auth token là do client truyền vào, module này chỉ save và get, không có nhiệm vụ check nó
  • thêm 1 file validate.go để viết các hàm validate
- module này không có quản lý việc generate token, nó nằm ở module UserManagement - auth token là do client truyền vào, module này chỉ save và get, không có nhiệm vụ check nó - thêm 1 file validate.go để viết các hàm validate
namhq1989 (Migrated from github.com) commented 2021-11-05 07:27:44 +00:00

DeviceCreate -> CreateOptions

DeviceCreate -> CreateOptions
namhq1989 (Migrated from github.com) commented 2021-11-05 07:31:39 +00:00

deviceID already exists -> this device is already existed

deviceID already exists -> this device is already existed
namhq1989 (Migrated from github.com) commented 2021-11-05 07:33:20 +00:00
return fmt.Errorf("error when create device: %s", err.Error())
```go return fmt.Errorf("error when create device: %s", err.Error()) ```
namhq1989 (Migrated from github.com) commented 2021-11-05 07:35:14 +00:00

move ra 1 func khác để validate

move ra 1 func khác để validate
namhq1989 (Migrated from github.com) commented 2021-11-05 07:35:31 +00:00

move ra 1 func khác để validate

move ra 1 func khác để validate
namhq1989 (Migrated from github.com) commented 2021-11-05 07:35:53 +00:00

move ra 1 func khác để validate

move ra 1 func khác để validate
namhq1989 (Migrated from github.com) commented 2021-11-05 07:36:56 +00:00

move ra 1 func khác để set, set cứng device.Language = langVi

move ra 1 func khác để set, set cứng `device.Language = langVi`
namhq1989 (Migrated from github.com) commented 2021-11-05 07:37:25 +00:00

ko cần check userID là mongo id, ko empty là được

ko cần check userID là mongo id, ko empty là được
namhq1989 (Migrated from github.com) commented 2021-11-05 07:37:32 +00:00

bỏ cái này

bỏ cái này
@ -0,0 +18,4 @@
IP string
FCMToken string
AuthToken string
Language string
namhq1989 (Migrated from github.com) commented 2021-11-05 07:30:27 +00:00

thiếu AuthToken

thiếu AuthToken
@ -0,0 +74,4 @@
}
// App version
if payload.AppVersion != "" {
namhq1989 (Migrated from github.com) commented 2021-11-05 07:36:05 +00:00

move ra 1 func khác để set

move ra 1 func khác để set
namhq1989 (Migrated from github.com) commented 2021-11-05 07:30:02 +00:00

device làm gì có generate token hè? generate token nằm ở bên User Management chớ

device làm gì có generate token hè? generate token nằm ở bên User Management chớ
namhq1989 (Migrated from github.com) commented 2021-11-05 07:37:49 +00:00

ko public cái này

ko public cái này
namhq1989 (Migrated from github.com) commented 2021-11-05 07:38:14 +00:00
langVi = "vi"
langEn = "en"
```go langVi = "vi" langEn = "en" ```
namhq1989 (Migrated from github.com) commented 2021-11-05 07:38:42 +00:00

bỏ cái này

bỏ cái này
namhq1989 (Migrated from github.com) commented 2021-11-05 07:39:37 +00:00

return thêm Service về nữa

func Init(config Config) (*Service, error) {
  // ...
  return s, nil
}
return thêm Service về nữa ```go func Init(config Config) (*Service, error) { // ... return s, nil } ```
@ -0,0 +7,4 @@
)
// Device ...
type Device struct {
namhq1989 (Migrated from github.com) commented 2021-11-05 07:41:01 +00:00

define thêm json vào metadata

define thêm `json` vào metadata
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:32:48 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:32:48 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:32:54 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:32:54 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:32:59 +00:00
@ -0,0 +18,4 @@
IP string
FCMToken string
AuthToken string
Language string
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:32:59 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:33:15 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:33:15 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:33:21 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:33:21 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:33:28 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:33:28 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:33:54 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:33:54 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:00 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:00 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:07 +00:00
@ -0,0 +74,4 @@
}
// App version
if payload.AppVersion != "" {
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:07 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:13 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:13 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:23 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:23 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:30 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:30 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:37 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:37 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:45 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:45 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:50 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:50 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:34:59 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:34:59 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 08:40:21 +00:00
@ -0,0 +7,4 @@
)
// Device ...
type Device struct {
lqhoang99 (Migrated from github.com) commented 2021-11-05 08:40:21 +00:00

done

done
namhq1989 (Migrated from github.com) reviewed 2021-11-05 08:58:39 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-05 08:58:38 +00:00

đoạn này + đoạn device id iszero, viết thành 1 func khác isDeviceIDExisted trả về boolean

đoạn này + đoạn device id iszero, viết thành 1 func khác `isDeviceIDExisted` trả về boolean
namhq1989 (Migrated from github.com) reviewed 2021-11-05 09:00:31 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-05 09:00:31 +00:00

deviceId, json dùng camel case, sửa luôn các id khác

deviceId, json dùng camel case, sửa luôn các id khác
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 09:12:09 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 09:12:09 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 09:12:15 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 09:12:15 +00:00

done

done
namhq1989 (Migrated from github.com) reviewed 2021-11-05 09:15:35 +00:00
@ -0,0 +25,4 @@
logger.Error("devicemngt - findByDeviceID", logger.LogData{
"deviceID": deviceID,
"err": err.Error(),
})
namhq1989 (Migrated from github.com) commented 2021-11-05 09:15:34 +00:00

chỗ này return luôn chớ?

chỗ này return luôn chớ?
namhq1989 (Migrated from github.com) reviewed 2021-11-05 09:17:08 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-05 09:17:08 +00:00

gom code khúc này thành return !device.ID.IsZero()

func này check device có tồn tại ko, nên nếu tồn tại trả true, ko tồn tại trả false

gom code khúc này thành `return !device.ID.IsZero()` func này check device có tồn tại ko, nên nếu tồn tại trả true, ko tồn tại trả false
namhq1989 (Migrated from github.com) reviewed 2021-11-05 09:17:35 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-05 09:17:35 +00:00

LastActivatedAt

LastActivatedAt
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 09:25:07 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 09:25:07 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 09:25:12 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-05 09:25:11 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-05 09:25:18 +00:00
@ -0,0 +25,4 @@
logger.Error("devicemngt - findByDeviceID", logger.LogData{
"deviceID": deviceID,
"err": err.Error(),
})
lqhoang99 (Migrated from github.com) commented 2021-11-05 09:25:18 +00:00

done

done
namhq1989 (Migrated from github.com) approved these changes 2021-11-05 09:27:31 +00:00
Sign in to join this conversation.
No description provided.