mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: migrate definition to api v1 (#1879)
* refactor: user api v1 * refactor: system setting to apiv1 * chore: remove unused definition * chore: update * chore: refactor: system setting * chore: update * refactor: migrate tag * feat: migrate activity store * refactor: migrate shortcut apiv1 * chore: update
This commit is contained in:
@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/usememos/memos/api"
|
||||
apiv1 "github.com/usememos/memos/api/v1"
|
||||
)
|
||||
|
||||
@ -20,7 +19,7 @@ func TestSystemServer(t *testing.T) {
|
||||
|
||||
status, err := s.getSystemStatus()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, (*api.User)(nil), status.Host)
|
||||
require.Equal(t, (*apiv1.User)(nil), status.Host)
|
||||
|
||||
signup := &apiv1.SignUp{
|
||||
Username: "testuser",
|
||||
@ -36,8 +35,8 @@ func TestSystemServer(t *testing.T) {
|
||||
require.Equal(t, user.Username, status.Host.Username)
|
||||
}
|
||||
|
||||
func (s *TestingServer) getSystemStatus() (*api.SystemStatus, error) {
|
||||
body, err := s.get("/api/status", nil)
|
||||
func (s *TestingServer) getSystemStatus() (*apiv1.SystemStatus, error) {
|
||||
body, err := s.get("/api/v1/status", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -48,12 +47,9 @@ func (s *TestingServer) getSystemStatus() (*api.SystemStatus, error) {
|
||||
return nil, errors.Wrap(err, "fail to read response body")
|
||||
}
|
||||
|
||||
type SystemStatusResponse struct {
|
||||
Data *api.SystemStatus `json:"data"`
|
||||
}
|
||||
res := new(SystemStatusResponse)
|
||||
if err = json.Unmarshal(buf.Bytes(), res); err != nil {
|
||||
systemStatus := &apiv1.SystemStatus{}
|
||||
if err = json.Unmarshal(buf.Bytes(), systemStatus); err != nil {
|
||||
return nil, errors.Wrap(err, "fail to unmarshal get system status response")
|
||||
}
|
||||
return res.Data, nil
|
||||
return systemStatus, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user