mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-03 20:21:40 +00:00
chore: update list shortcut api
This commit is contained in:
@ -83,7 +83,7 @@ func (s *APIV1Service) registerShortcutRoutes(g *echo.Group) {
|
||||
Name: strings.ToLower(create.Name),
|
||||
Link: create.Link,
|
||||
Description: create.Description,
|
||||
Visibility: convertVisibilityToStore(create.Visibility),
|
||||
Visibility: store.Visibility(create.Visibility.String()),
|
||||
Tag: strings.Join(create.Tags, " "),
|
||||
})
|
||||
if err != nil {
|
||||
@ -176,13 +176,6 @@ func (s *APIV1Service) registerShortcutRoutes(g *echo.Group) {
|
||||
}
|
||||
|
||||
find := &store.FindShortcut{}
|
||||
if creatorIDStr := c.QueryParam("creatorId"); creatorIDStr != "" {
|
||||
creatorID, err := strconv.Atoi(creatorIDStr)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("unwanted creator id string: %s", creatorIDStr))
|
||||
}
|
||||
find.CreatorID = &creatorID
|
||||
}
|
||||
if tag := c.QueryParam("tag"); tag != "" {
|
||||
find.Tag = &tag
|
||||
}
|
||||
@ -325,19 +318,6 @@ func (s *APIV1Service) composeShortcut(ctx context.Context, shortcut *Shortcut)
|
||||
return shortcut, nil
|
||||
}
|
||||
|
||||
func convertVisibilityToStore(visibility Visibility) store.Visibility {
|
||||
switch visibility {
|
||||
case VisibilityPrivate:
|
||||
return store.VisibilityPrivate
|
||||
case VisibilityWorkspace:
|
||||
return store.VisibilityWorkspace
|
||||
case VisibilityPublic:
|
||||
return store.VisibilityPublic
|
||||
default:
|
||||
return store.VisibilityPrivate
|
||||
}
|
||||
}
|
||||
|
||||
func convertShortcutFromStore(shortcut *store.Shortcut) *Shortcut {
|
||||
tags := []string{}
|
||||
if shortcut.Tag != "" {
|
||||
|
Reference in New Issue
Block a user