Add existing codebase
This commit is contained in:
commit
c23a68347b
16 changed files with 807 additions and 0 deletions
26
link/dto.go
Normal file
26
link/dto.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package link
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CreationModel struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
RedirectURL string `json:"redirectUrl"`
|
||||
}
|
||||
|
||||
func (m *CreationModel) MapModelToEntity() (*Link, error) {
|
||||
u, err := url.Parse(m.RedirectURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Link{
|
||||
Id: m.Id,
|
||||
Name: m.Name,
|
||||
RedirectURL: *u,
|
||||
CreationTime: time.Now().UTC(),
|
||||
}, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue