feat(user): add user type modification endpoint
- Implement new endpoint `/userMgr/modifyType` for updating user types - Add database function DBUpdateUserType to handle type updates - Include request validation and proper error handling - Update API documentation with new endpoint details
This commit is contained in:
@@ -346,6 +346,14 @@ func DBQuerySpecificUser(userID int) (User, error) { // Query user by ID
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func DBUpdateUserType (userID int, newType string) error {
|
||||
_, err := db.Exec("UPDATE userLogin SET type = ? WHERE userID = ?", newType, userID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update user type: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DBAddFrpcInstance(instance FrpcInstance) error {
|
||||
_, err := frpcDB.Exec("INSERT INTO frpcInstances (userID, name, bootAtStart, runUser, configPath, createdAt) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
instance.UserID, instance.Name, instance.BootAtStart, instance.RunUser, instance.ConfigPath, time.Now().Format(time.RFC3339))
|
||||
|
||||
Reference in New Issue
Block a user