fixed api stuff
This commit is contained in:
@@ -18,12 +18,18 @@ type Connection struct {
|
||||
connection *mongo.Client
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
Username string
|
||||
Permissions models.Permission
|
||||
Email string
|
||||
}
|
||||
|
||||
func (con Connection) GetUsers(c *gin.Context) {
|
||||
users, err := con.connection.Database("Backend").Collection("Users").Find(context.TODO(), bson.D{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var response []models.User
|
||||
var response []UserResponse
|
||||
|
||||
err = users.All(context.TODO(), &response)
|
||||
|
||||
@@ -34,12 +40,6 @@ func (con Connection) GetUsers(c *gin.Context) {
|
||||
c.IndentedJSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
Username string
|
||||
Permissions models.Permission
|
||||
Email string
|
||||
}
|
||||
|
||||
func (con Connection) GetUser(c *gin.Context) {
|
||||
claims, exists := c.Get("claims")
|
||||
if !exists {
|
||||
|
Reference in New Issue
Block a user