mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-02 14:56:38 +08:00
refactor(idgen): centralize negative ID handling via panic
Restore NextUint64ID() to uint64-only API so callers need no error checks. Retry logic stays in idgen; after 3 negative values it panics instead of returning 0, preventing silent NULL primary keys.
This commit is contained in:
@@ -386,14 +386,8 @@ func CreateUser(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
nextID, err := idgen.NextUint64ID()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, response.Err(createUserFailed))
|
||||
return
|
||||
}
|
||||
|
||||
newUser := model.User{
|
||||
ID: nextID,
|
||||
ID: idgen.NextUint64ID(),
|
||||
Username: req.Username,
|
||||
Nickname: req.Nickname,
|
||||
Email: req.Email,
|
||||
|
||||
Reference in New Issue
Block a user