diff options
author | 2024-10-18 11:59:05 +0800 | |
---|---|---|
committer | 2024-10-17 20:59:05 -0700 | |
commit | 0adbcc3a04aafc203d8303048e4ab82918463b2b (patch) | |
tree | 14426bd998be18cef047e7abf4bf8b10bf04bb7c /internal/api/user.go | |
parent | 7fdb450446aded0f95f490a0fee275e3dfdf507b (diff) | |
download | v2-0adbcc3a04aafc203d8303048e4ab82918463b2b.tar.gz v2-0adbcc3a04aafc203d8303048e4ab82918463b2b.tar.zst v2-0adbcc3a04aafc203d8303048e4ab82918463b2b.zip |
feat(api): add endpoint for user integration status
Diffstat (limited to '')
-rw-r--r-- | internal/api/user.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/api/user.go b/internal/api/user.go index 71d70e9c..112c19a2 100644 --- a/internal/api/user.go +++ b/internal/api/user.go @@ -130,6 +130,25 @@ func (h *handler) markUserAsRead(w http.ResponseWriter, r *http.Request) { json.NoContent(w, r) } +func (h *handler) getIntegrationsStatus(w http.ResponseWriter, r *http.Request) { + userID := request.UserID(r) + + if _, err := h.store.UserByID(userID); err != nil { + json.NotFound(w, r) + return + } + + hasIntegrations := h.store.HasSaveEntry(userID) + + response := struct { + HasIntegrations bool `json:"has_integrations"` + }{ + HasIntegrations: hasIntegrations, + } + + json.OK(w, r, response) +} + func (h *handler) users(w http.ResponseWriter, r *http.Request) { if !request.IsAdminUser(r) { json.Forbidden(w, r) |