1package server
2
3import (
4 "github.com/haileyok/cocoon/internal/helpers"
5 "github.com/labstack/echo/v4"
6)
7
8type ComAtprotoSyncGetRepoStatusResponse struct {
9 Did string `json:"did"`
10 Active bool `json:"active"`
11 Status *string `json:"status,omitempty"`
12 Rev *string `json:"rev,omitempty"`
13}
14
15// TODO: make this actually do the right thing
16func (s *Server) handleSyncGetRepoStatus(e echo.Context) error {
17 did := e.QueryParam("did")
18 if did == "" {
19 return helpers.InputError(e, nil)
20 }
21
22 urepo, err := s.getRepoActorByDid(did)
23 if err != nil {
24 return err
25 }
26
27 return e.JSON(200, ComAtprotoSyncGetRepoStatusResponse{
28 Did: urepo.Repo.Did,
29 Active: urepo.Active(),
30 Status: urepo.Status(),
31 Rev: &urepo.Rev,
32 })
33}