mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 19:49:16 +00:00
32 lines
609 B
Go
32 lines
609 B
Go
|
package databag
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"databag/internal/store"
|
||
|
)
|
||
|
|
||
|
type cardView struct {
|
||
|
CardId string
|
||
|
ProfileRevision int64
|
||
|
DataRevision int64
|
||
|
RemoteProfile int64
|
||
|
RemoteContent int64
|
||
|
}
|
||
|
|
||
|
func GetCardView(w http.ResponseWriter, r *http.Request) {
|
||
|
|
||
|
account, code, err := BearerAppToken(r, false);
|
||
|
if err != nil {
|
||
|
ErrResponse(w, code, err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
var views []CardView
|
||
|
if err := store.DB.Model(&store.Card{}).Where("account_id = ?", account.ID).Find(&views).Error; err != nil {
|
||
|
ErrResponse(w, http.StatusInternalServerError, err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
WriteResponse(w, &views)
|
||
|
}
|