add createMethod #1
|
@ -7,17 +7,18 @@ import (
|
|||
|
||||
|
||||
"github.com/Selly-Modules/logger"
|
||||
"github.com/Selly-Modules/mongodb"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
)
|
||||
|
||||
// CreateOptions ...
|
||||
type CreateOptions struct {
|
||||
Name string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Phone string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Email string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
HashPassword string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Status string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
RoleID string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Other string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Name string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Phone string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Email string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
HashedPassword string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Status string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
RoleID primitive.ObjectID
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Other string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
}
|
||||
|
||||
// Create ...
|
||||
|
@ -39,9 +40,14 @@ func (s Service) Create(payload CreateOptions) error {
|
|||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
![]() done done
![]() done done
|
||||
return err
|
||||
}
|
||||
|
||||
// Find phone,email exists or not
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
if s.haveNameOrPhoneExisted(ctx, userData.Phone, userData.Email) {
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
return errors.New("have name or phone existed")
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
// Find roleID exists or not
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
if !s.isRoleIDAlreadyExisted(ctx, userData.RoleID) {
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
return errors.New("roleID does not exist")
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
}
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
// Find phone number,email exists or not
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
if s.isPhoneNumberOrEmailAlreadyExisted(ctx, userData.Phone, userData.Email) {
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
return errors.New("phone number or email already existed")
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
}
|
||||
|
||||
// Create device
|
||||
|
@ -59,24 +65,16 @@ func (s Service) Create(payload CreateOptions) error {
|
|||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
![]() done done
![]() done done
|
||||
|
||||
func (payload CreateOptions) newUser() (result User, err error) {
|
||||
timeNow := now()
|
||||
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
// New RoleID from string
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
roleID, isValid := mongodb.NewIDFromString(payload.RoleID)
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
if !isValid {
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
err = errors.New("invalid roleID")
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
return
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
}
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
return User{
|
||||
ID: mongodb.NewObjectID(),
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Name: payload.Name,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Phone: payload.Phone,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Email: payload.Email,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
HashPassword: payload.HashPassword,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Status: payload.Status,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
RoleID: roleID,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Other: payload.Other,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
CreatedAt: timeNow,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
UpdatedAt: timeNow,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
ID: mongodb.NewObjectID(),
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Name: payload.Name,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Phone: payload.Phone,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Email: payload.Email,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
HashedPassword: payload.HashedPassword,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Status: payload.Status,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
RoleID: payload.RoleID,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
Other: payload.Other,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
CreatedAt: timeNow,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
UpdatedAt: timeNow,
|
||||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
|
||||
}, nil
|
||||
}
|
||||
|
|
|||
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() boolean thì:
trên sửa lại boolean thì:
- check existed dùng prefix `is`
- check có value, field nào đó dùng prefix `has`
trên sửa lại `isNameOrPhoneExisted`
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() have name or phone existed -> phone number or email already existed have name or phone existed -> phone number or email already existed
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() thiếu check roleId trong db thiếu check roleId trong db
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() isRoleIDAlreadyExisted -> isRoleIDExisted isRoleIDAlreadyExisted -> isRoleIDExisted
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() roleID does not exist -> role id does not exist lỗi là ngữ cảnh cho user đọc, nên viết clear tí roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() func này với func isRoleIDExisted nên đưa vô func func này với func isRoleIDExisted nên đưa vô func `payload.validate()`, gom tất cả validate trước khi xử lý về 1 chỗ
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() bỏ dấu space sau Create bỏ dấu space sau Create
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() password do module này hash, xem link này: password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() nên là note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được nên là `string`, nếu client không dùng mongodb thì phải cài thêm thư viện
note: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
![]() done done
![]() done done
![]() done done
![]() done done
|
|
@ -3,6 +3,7 @@ package usermngmt
|
|||
// Constant ...
|
||||
const (
|
||||
tableUser = "users"
|
||||
tableRole = "roles"
|
||||
|
||||
timezoneHCM = "Asia/Ho_Chi_Minh"
|
||||
)
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
![]() done done
|
||||
package usermngmt
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
import (
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"context"
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"fmt"
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"github.com/Selly-Modules/logger"
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
)
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
// getUserCollection ...
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
func (s Service) getUserCollection() *mongo.Collection {
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
return s.DB.Collection(fmt.Sprintf("%s-%s", s.TablePrefix, tableUser))
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
// getRoleCollection ...
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
func (s Service) getRoleCollection() *mongo.Collection {
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
return s.DB.Collection(fmt.Sprintf("%s-%s", s.TablePrefix, tableRole))
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
func (s Service) isPhoneNumberOrEmailAlreadyExisted(ctx context.Context, phone, email string) bool {
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
var (
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
col = s.getUserCollection()
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
user = User{}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
)
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
// Find
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
cond := bson.M{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"$or": []bson.M{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"phone": phone,
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
},
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"email": email,
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
},
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
},
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
if err := col.FindOne(ctx, cond).Decode(&user); err != nil {
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
logger.Error("usermngmt - findByCondition", logger.LogData{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"condition": cond,
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"err": err.Error(),
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
})
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
return true
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
return !user.ID.IsZero()
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
func (s Service) isRoleIDAlreadyExisted(ctx context.Context, roleID primitive.ObjectID) bool {
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
var (
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
col = s.getRoleCollection()
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
role = Role{}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
)
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
// Find
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
cond := bson.M{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"_id": roleID,
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
if err := col.FindOne(ctx, cond).Decode(&role); err != nil {
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
logger.Error("usermngmt - findRoleByCondition", logger.LogData{
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"condition": cond,
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
"err": err.Error(),
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
})
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
return false
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
return !role.ID.IsZero()
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
||||
}
|
||||
![]() isPhoneNumberOrPhoneExisted isPhoneNumberOrPhoneExisted
![]() chỗ này count là được chớ cần gì find chỗ này count là được chớ cần gì find
![]() count luôn count luôn
![]() done done
![]() done done
![]() done done
![]() set default rồi, bỏ cái này đi set default rồi, bỏ cái này đi
![]() done done
|
41
helper.go
|
@ -1,42 +1 @@
|
|||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
![]() done done
|
||||
package usermngmt
|
||||
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
import (
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"context"
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"fmt"
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"github.com/Selly-Modules/logger"
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
)
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
// getUserCollection ...
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
func (s Service) getUserCollection() *mongo.Collection {
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
return s.DB.Collection(fmt.Sprintf("%s-%s", s.TablePrefix, tableUser))
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
}
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
func (s Service) haveNameOrPhoneExisted(ctx context.Context, phone, email string) bool {
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
var (
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
col = s.getUserCollection()
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
user = User{}
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
)
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
// Find
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
cond := bson.M{
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"$or": []bson.M{
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
{
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"phone": phone,
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
},
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
{
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"email": email,
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
},
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
},
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
}
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
if err := col.FindOne(ctx, cond).Decode(&user); err != nil {
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
logger.Error("usermngmt - findByCondition", logger.LogData{
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"condition": cond,
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
"err": err.Error(),
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
})
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
return true
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
}
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
return !user.ID.IsZero()
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
}
|
||||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
|
||||
|
|
|||
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi mấy method này nên tạo 1 file db.go để đưa vào, bên hàm export chỉ cần call vào thôi
xử lý db gom về 1 chỗ đúng hơn
![]() done done
![]() done done
|
30
model.go
|
@ -8,14 +8,24 @@ import (
|
|||
![]() HashedPassword HashedPassword
![]() HashedPassword HashedPassword
![]() done done
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]()
`bson:"roleId"`
![]() done done
![]() done done
![]() done done
![]() done done
|
||||
|
||||
// User ...
|
||||
type User struct {
|
||||
ID primitive.ObjectID `bson:"_id" json:"_id"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Name string `bson:"name" json:"name"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Phone string `bson:"phone" json:"phone"` // unique
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Email string `bson:"email" json:"email"` // unique
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
HashPassword string `bson:"hashPassword" json:"hashPassword"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Status string `bson:"status" json:"status"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
RoleID primitive.ObjectID `bson:"roleID" json:"roleId"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Other string `bson:"other" json:"other"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
ID primitive.ObjectID `bson:"_id" json:"_id"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Name string `bson:"name" json:"name"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Phone string `bson:"phone" json:"phone"` // unique
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Email string `bson:"email" json:"email"` // unique
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
HashedPassword string `bson:"hashedPassword" json:"hashedPassword"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Status string `bson:"status" json:"status"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
RoleID primitive.ObjectID `bson:"roleID" json:"roleId"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Other string `bson:"other" json:"other"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
}
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
// Role ...
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
type Role struct {
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
ID primitive.ObjectID `bson:"_id" json:"_id"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Name string `bson:"name" json:"name"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
Code string `bson:"code" json:"code"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
IsAdmin bool `bson:"isAdmin" json:"isAdmin"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
|
||||
![]() HashedPassword HashedPassword
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]() done done
![]() done done
|
||||
}
|
||||
|
|
|||
![]() HashedPassword HashedPassword
![]() HashedPassword HashedPassword
![]() done done
![]() done done
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]() password không trả về ở json, để password không trả về ở json, để `-`
![]()
`bson:"roleId"`
![]()
`bson:"roleId"`
![]() done done
![]() done done
![]() done done
![]() done done
|
14
validate.go
|
@ -31,12 +31,12 @@ func (co CreateOptions) validate() error {
|
|||
![]() check plain password check plain password
![]() check plain password check plain password
![]() done done
![]() done done
|
||||
return errors.New("no email data")
|
||||
}
|
||||
|
||||
// HashPassword
|
||||
![]() check plain password check plain password
![]() done done
|
||||
if co.HashPassword == "" {
|
||||
![]() check plain password check plain password
![]() done done
|
||||
logger.Error("usermngmt - Create: no hashPassword data", logger.LogData{
|
||||
![]() check plain password check plain password
![]() done done
|
||||
// HashedPassword
|
||||
![]() check plain password check plain password
![]() done done
|
||||
if co.HashedPassword == "" {
|
||||
![]() check plain password check plain password
![]() done done
|
||||
logger.Error("usermngmt - Create: no hashedPassword data", logger.LogData{
|
||||
![]() check plain password check plain password
![]() done done
|
||||
"payload": co,
|
||||
})
|
||||
return errors.New("no hashPassword data")
|
||||
![]() check plain password check plain password
![]() done done
|
||||
return errors.New("no hashedPassword data")
|
||||
![]() check plain password check plain password
![]() done done
|
||||
}
|
||||
|
||||
// Status
|
||||
|
@ -48,11 +48,11 @@ func (co CreateOptions) validate() error {
|
|||
![]() check plain password check plain password
![]() check plain password check plain password
![]() done done
![]() done done
|
||||
}
|
||||
|
||||
// RoleID
|
||||
if co.RoleID == "" {
|
||||
![]() check plain password check plain password
![]() done done
|
||||
logger.Error("usermngmt - Create: no roleID data", logger.LogData{
|
||||
![]() check plain password check plain password
![]() done done
|
||||
if co.RoleID.IsZero() {
|
||||
![]() check plain password check plain password
![]() done done
|
||||
logger.Error("usermngmt - Create: invalid roleID data", logger.LogData{
|
||||
![]() check plain password check plain password
![]() done done
|
||||
"payload": co,
|
||||
})
|
||||
return errors.New("no roleID data")
|
||||
![]() check plain password check plain password
![]() done done
|
||||
return errors.New("invalid roleID data")
|
||||
![]() check plain password check plain password
![]() done done
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|||
![]() check plain password check plain password
![]() check plain password check plain password
![]() done done
![]() done done
|
boolean thì:
is
has
trên sửa lại
isNameOrPhoneExisted
boolean thì:
is
has
trên sửa lại
isNameOrPhoneExisted
have name or phone existed -> phone number or email already existed
have name or phone existed -> phone number or email already existed
thiếu check roleId trong db
thiếu check roleId trong db
done
done
done
done
done
done
password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
password client truyền vào là plain text, module này mới convert qua hash, đặt là hashedPassword
isRoleIDAlreadyExisted -> isRoleIDExisted
isRoleIDAlreadyExisted -> isRoleIDExisted
roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
roleID does not exist -> role id does not exist
lỗi là ngữ cảnh cho user đọc, nên viết clear tí
func này với func isRoleIDExisted nên đưa vô func
payload.validate()
, gom tất cả validate trước khi xử lý về 1 chỗfunc này với func isRoleIDExisted nên đưa vô func
payload.validate()
, gom tất cả validate trước khi xử lý về 1 chỗbỏ dấu space sau Create
bỏ dấu space sau Create
password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
password do module này hash, xem link này:
https://gowebexamples.com/password-hashing/
done
done
done
done
done
done
done
done
done
done
done
done
đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
đoạn này move qua db.go luôn, phân tách ra để gọn hàm, và đúng file
nên là
string
, nếu client không dùng mongodb thì phải cài thêm thư việnnote: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
nên là
string
, nếu client không dùng mongodb thì phải cài thêm thư việnnote: xử lý làm sao chỉ dùng type của go và của module, client chỉ cần cài 1 module này là sử dụng được
done
done
done
done