2022-03-09 07:05:04 +00:00
|
|
|
package databag
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"databag/internal/store"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetAccountListing(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
var accounts []store.Account
|
|
|
|
if err := store.DB.Preload("AccountDetail").Where("searchable = ? AND disabled = ?", true, false).Find(&accounts).Error; err != nil {
|
|
|
|
ErrResponse(w, http.StatusInternalServerError, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
profiles := []CardProfile{}
|
|
|
|
for _, account := range accounts {
|
|
|
|
profiles = append(profiles, CardProfile{
|
2022-07-22 17:15:44 +00:00
|
|
|
GUID: account.GUID,
|
2022-03-09 07:05:04 +00:00
|
|
|
Handle: account.Username,
|
|
|
|
Name: account.AccountDetail.Name,
|
|
|
|
Description: account.AccountDetail.Description,
|
|
|
|
Location: account.AccountDetail.Location,
|
|
|
|
ImageSet: account.AccountDetail.Image != "",
|
|
|
|
Version: APP_VERSION,
|
2022-03-17 21:42:51 +00:00
|
|
|
Node: getStrConfigValue(CONFIG_DOMAIN, ""),
|
2022-03-09 07:05:04 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteResponse(w, &profiles)
|
|
|
|
}
|
|
|
|
|