Чуть измени список пользователей
parent
4499a3c7f2
commit
f067e68d3d
|
@ -93,7 +93,26 @@ func GetUserList(app application.App, user auth.User, r render.Render) {
|
||||||
var users []auth.UserModel
|
var users []auth.UserModel
|
||||||
var tmp auth.UserModel
|
var tmp auth.UserModel
|
||||||
var tmpTime string
|
var tmpTime string
|
||||||
var results, err = app.DB.Query(`SELECT id, name, surname, birthdate, gender, city FROM users`)
|
query := fmt.Sprintf(`SELECT
|
||||||
|
users.id as id,
|
||||||
|
users.name as name,
|
||||||
|
users.surname as surname,
|
||||||
|
users.birthdate as birthdate,
|
||||||
|
users.gender as gender,
|
||||||
|
users.city as city
|
||||||
|
FROM
|
||||||
|
users
|
||||||
|
WHERE
|
||||||
|
NOT users.id=%d
|
||||||
|
AND users.id NOT IN (
|
||||||
|
SELECT
|
||||||
|
relations.friendId
|
||||||
|
FROM
|
||||||
|
relations
|
||||||
|
WHERE
|
||||||
|
relations.userId=%d)`, int(user.(*auth.UserModel).Id), int(user.(*auth.UserModel).Id))
|
||||||
|
|
||||||
|
var results, err = app.DB.Query(query)
|
||||||
if err != nil || results == nil {
|
if err != nil || results == nil {
|
||||||
err500("can't get user list from DB: ", err, r)
|
err500("can't get user list from DB: ", err, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>List of all users</h2>
|
<h2>List of all unrelated users</h2>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in New Issue