package
0.0.0-20250212031707-4f0783f31f2e
Repository: https://github.com/qw1281065768/trash_be.git
Documentation: pkg.go.dev
# Functions
AccessResource - can be accessed by basic auth.
Activate2FA - activate 2FA upon validation
- possible for accounts without 2FA-ON
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"otp":"..."}`.
APIStatus - check status of the API.
查询所有的挂机任务.
使用idl生成代码,还需要返回总时间.
CreateBackup2FA - get new set of 2FA backup codes
- 2FA must already be enabled for the user account
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`.
CreatePost - POST /posts.
CreateUserAuth - register a new user account
[POST]: /register
dependency: relational database
Accepted JSON payload:
`{"email":"...", "password":"..."}`.
CreateVerificationEmail issues new verification code upon request
dependency: email service, email verification service, Redis
Accepted JSON payload:
`{"email":"...", "password":"..."}`.
Deactivate2FA - disable 2FA for user account
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`.
DeletePost - DELETE /posts/:id.
GetHobbies - GET /hobbies.
GetMapInfo.
GetPost - GET /posts/:id.
GetPosts - GET /posts.
GetUnverifiedEmail - if any email is yet to be verified, return it to the logged-in user
When this email is verified, it will replace the existing active email of the user.
No description provided by the author
GetUserItems - GET ALL.
No description provided by the author
GetUserMaps - GET ALL.
Login - issue new JWTs after user:pass verification
[POST]: /login
dependency: relational database, JWT
Accepted JSON payload:
`{"email":"...", "password":"..."}`.
Logout -
- if 'AUTH_COOKIE_ACTIVATE=yes', delete tokens from client browser.
MongoCreateOne - create one document.
MongoDeleteByID - delete one document by ID.
MongoDeleteFieldByID - delete existing field(s) from a document.
MongoGetAll - get all documents.
MongoGetByFilter - find documents using filter.
MongoGetByID - find one document by ID.
MongoUpdateByID - update a document
- edit existing fields - add new fields - do not remove any existing field.
PasswordForgot sends secret code for resetting a forgotten password
dependency: relational database, Redis, email service, password recovery service
Accepted JSON payload:
`{"email":"..."}`.
PasswordRecover resets a forgotten password
dependency: relational database, Redis
Accepted JSON payload:
`{"secretCode":"...", "passNew":"...", "passRepeat":"...", "recoveryKey":"..."}`
- `recoveryKey` is required if 2FA is enabled for the user account.
PasswordUpdate - change password in logged-in state
dependency: relational database, JWT
Accepted JSON payload:
`{"password":"...", "passNew":"...", "passRepeat":"..."}`.
QueryString - basic implementation.
RedisCreate - SET key.
RedisCreateHash - SET hashes.
RedisDelete - DEL key.
RedisDeleteHash - DEL hashes.
RedisRead - GET key.
RedisReadHash - GET hashes.
Refresh - issue new JWTs after validation
dependency: JWT.
ResendVerificationCodeToModifyActiveEmail issues new verification code upon request
dependency: email service, email verification service, Redis, relational database, JWT.
Setup2FA - get secret to activate 2FA
- possible for accounts without 2FA-ON
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`.
SingleSellItems - GET 单个卖,以及多个卖.
QueryString - basic implementation.
GetPosts - GET /posts.
UpdateEmail - update existing user email
dependency: relational database, JWT
Accepted JSON payload:
`{"emailNew":"...", "password":"..."}`.
UpdatePost - PUT /posts/:id.
Validate2FA - issue new JWTs upon 2FA validation
- required for accounts with 2FA-ON
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"otp":"..."}`.
ValidateBackup2FA - issue new JWTs upon 2FA validation with backup code
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"otp":"..."}`.
VerifyEmail - verify email address of a newly registered user account
dependency: email verification service, Redis
Accepted JSON payload:
`{"verificationCode":"..."}`.
VerifyUpdatedEmail - verify request to modify user's email address
dependency: email verification service, relational database, redis
Accepted JSON payload:
`{"verificationCode":"..."}`.