-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f3727a
commit b8cad11
Showing
4 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dto | ||
|
||
import ( | ||
"github.com/ItsNotGoodName/reciva-web-remote/core/preset" | ||
) | ||
|
||
type Preset struct { | ||
TitleNew string `json:"title_new"` | ||
URL string `json:"url"` | ||
URLNew string `json:"url_new"` | ||
} | ||
|
||
func ConvertPreset(p *Preset) (*preset.Preset, error) { | ||
return preset.ParsePreset(p.URL, p.TitleNew, p.URLNew) | ||
} | ||
|
||
func NewPreset(p *preset.Preset) Preset { | ||
return Preset{ | ||
TitleNew: p.TitleNew, | ||
URL: p.URL, | ||
URLNew: p.URLNew, | ||
} | ||
} | ||
|
||
func NewPresets(ps []preset.Preset) []Preset { | ||
presets := make([]Preset, len(ps)) | ||
for i, p := range ps { | ||
presets[i] = Preset{TitleNew: p.TitleNew, URL: p.URL, URLNew: p.URLNew} | ||
} | ||
|
||
return presets | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters