init
This commit is contained in:
5
domain/domain.go
Normal file
5
domain/domain.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package domain
|
||||
|
||||
type Domain interface {
|
||||
Movies
|
||||
}
|
||||
10
domain/movies.go
Normal file
10
domain/movies.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"gitlab.com/arkadooti.sarkar/go-boilerplate/core/appcontext"
|
||||
"gitlab.com/arkadooti.sarkar/go-boilerplate/models"
|
||||
)
|
||||
|
||||
type Movies interface {
|
||||
GetMovieDetailsFromApi(ctx appcontext.AppContext, movieName string) (models.MovieDetails, error)
|
||||
}
|
||||
21
domain/standard/movieDetails.go
Normal file
21
domain/standard/movieDetails.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package standard
|
||||
|
||||
import (
|
||||
"gitlab.com/arkadooti.sarkar/go-boilerplate/core/appcontext"
|
||||
"gitlab.com/arkadooti.sarkar/go-boilerplate/models"
|
||||
"gitlab.com/arkadooti.sarkar/go-boilerplate/utils"
|
||||
)
|
||||
|
||||
func (s *Standard) GetMovieDetailsFromApi(ctx appcontext.AppContext, movieName string) (models.MovieDetails, error) {
|
||||
|
||||
apiParam := utils.ApiParam{
|
||||
Url: "http://www.omdbapi.com/?apikey=d2bd086",
|
||||
Query: map[string]string{"t": movieName},
|
||||
}
|
||||
movieDetails := models.MovieDetails{}
|
||||
err := apiParam.CallAPI(ctx, &movieDetails)
|
||||
if err != nil {
|
||||
return models.MovieDetails{}, err
|
||||
}
|
||||
return movieDetails, nil
|
||||
}
|
||||
13
domain/standard/standard.go
Normal file
13
domain/standard/standard.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package standard
|
||||
|
||||
import "gitlab.com/arkadooti.sarkar/go-boilerplate/db"
|
||||
|
||||
type Standard struct {
|
||||
DbMongo db.Databases
|
||||
}
|
||||
|
||||
func NewDomainService(mongo db.Databases) *Standard {
|
||||
return &Standard{
|
||||
DbMongo: mongo,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user