add createMethod #1

Merged
lqhoang99 merged 4 commits from feature/CreateMethod into master 2021-11-08 16:41:17 +00:00
lqhoang99 commented 2021-11-08 04:55:12 +00:00 (Migrated from github.com)
No description provided.
namhq1989 (Migrated from github.com) reviewed 2021-11-08 06:30:48 +00:00
namhq1989 (Migrated from github.com) left a comment

check

check
namhq1989 (Migrated from github.com) commented 2021-11-08 04:59:35 +00:00

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ì: - check existed dùng prefix `is` - check có value, field nào đó dùng prefix `has` trên sửa lại `isNameOrPhoneExisted`
namhq1989 (Migrated from github.com) commented 2021-11-08 05:00:10 +00:00

have name or phone existed -> phone number or email already existed

have name or phone existed -> phone number or email already existed
namhq1989 (Migrated from github.com) commented 2021-11-08 05:00:44 +00:00

thiếu check roleId trong db

thiếu check roleId trong db
namhq1989 (Migrated from github.com) commented 2021-11-08 06:29:39 +00:00

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 xử lý db gom về 1 chỗ đúng hơn
namhq1989 (Migrated from github.com) commented 2021-11-08 06:29:56 +00:00

HashedPassword

HashedPassword
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 08:35:03 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 08:35:03 +00:00

done

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

done

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

done

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

done

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

done

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

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
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:40:23 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:40:23 +00:00

isRoleIDAlreadyExisted -> isRoleIDExisted

isRoleIDAlreadyExisted -> isRoleIDExisted
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:41:08 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:41:08 +00:00

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í
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:42:57 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:42:57 +00:00

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ỗ
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:43:41 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:43:41 +00:00

bỏ dấu space sau Create

bỏ dấu space sau Create
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:44:27 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:44:27 +00:00

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/
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:45:56 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:45:56 +00:00

isPhoneNumberOrPhoneExisted

isPhoneNumberOrPhoneExisted
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:46:20 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:46:20 +00:00

chỗ này count là được chớ cần gì find

chỗ này count là được chớ cần gì find
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:46:39 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:46:39 +00:00

count luôn

count luôn
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:47:17 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:47:16 +00:00

password không trả về ở json, để -

password không trả về ở json, để `-`
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:47:28 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:47:28 +00:00

bson:"roleId"

`bson:"roleId"`
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:48:23 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:48:22 +00:00

TablePrefix không require, nếu không có thì để default là usermngmt

TablePrefix không require, nếu không có thì để default là `usermngmt`
namhq1989 (Migrated from github.com) reviewed 2021-11-08 08:48:41 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 08:48:40 +00:00

check plain password

check plain password
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:55:12 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:55:12 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:55:20 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:55:20 +00:00

done

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

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:55:31 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:55:31 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:55:36 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:55:36 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:55:43 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:55:43 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:56:01 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:56:01 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:56:06 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:56:06 +00:00

done

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

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:56:16 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:56:15 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:56:20 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:56:20 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:56:27 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:56:27 +00:00

done

done
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 09:56:43 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 09:56:43 +00:00

done

done
namhq1989 (Migrated from github.com) reviewed 2021-11-08 10:48:47 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 10:48:46 +00:00

chỗ này chưa thấy check default

if config.TablePrefix == "" {
  config.TablePrefix = ... // set trong config, default `usermngmt `
}

bên func get collection không cần check gì nữa

chỗ này chưa thấy check default ```go if config.TablePrefix == "" { config.TablePrefix = ... // set trong config, default `usermngmt ` } ``` bên func get collection không cần check gì nữa
namhq1989 (Migrated from github.com) reviewed 2021-11-08 10:49:06 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 10:49:06 +00:00

set default rồi, bỏ cái này đi

set default rồi, bỏ cái này đi
namhq1989 (Migrated from github.com) reviewed 2021-11-08 10:50:09 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 10:50:08 +00:00

đ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
namhq1989 (Migrated from github.com) reviewed 2021-11-08 10:50:31 +00:00
namhq1989 (Migrated from github.com) commented 2021-11-08 10:50:31 +00:00

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à `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
lqhoang99 (Migrated from github.com) reviewed 2021-11-08 11:22:10 +00:00
lqhoang99 (Migrated from github.com) commented 2021-11-08 11:22:10 +00:00

done

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

done

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

done

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

done

done
Sign in to join this conversation.
No description provided.