-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https: //github.com/acmcsufoss/i/issues/18 Co-Authored-By: Akanksh Jagadish <[email protected]> Co-Authored-By: John Carlo Manuel <[email protected]>
- Loading branch information
1 parent
f251d80
commit 31a0d6c
Showing
4 changed files
with
126 additions
and
121 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
92 changes: 47 additions & 45 deletions
92
internal/api/services/events_service.go → internal/api/services/events/service.go
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 |
---|---|---|
@@ -1,45 +1,47 @@ | ||
package services | ||
|
||
import ( | ||
"github.com/swaggest/usecase" | ||
|
||
"github.com/acmcsufoss/api.acmcsuf.com/internal/db/sqlite" | ||
) | ||
|
||
var _ Service = EventsService{} | ||
|
||
type EventsService struct { | ||
q *sqlite.Queries | ||
} | ||
|
||
func NewEventsService(q *sqlite.Queries) *EventsService { | ||
return &EventsService{q} | ||
} | ||
|
||
func (s EventsService) Resources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) PostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) BatchPostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) Resource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) PostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) BatchPostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) DeleteResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
package events | ||
|
||
import ( | ||
"github.com/swaggest/usecase" | ||
|
||
"github.com/acmcsufoss/api.acmcsuf.com/internal/api/services" | ||
"github.com/acmcsufoss/api.acmcsuf.com/internal/db/sqlite" | ||
) | ||
|
||
var _ services.Service = EventsService{} | ||
|
||
type EventsService struct { | ||
q *sqlite.Queries | ||
} | ||
|
||
func New(q *sqlite.Queries) *EventsService { | ||
return &EventsService{q} | ||
} | ||
|
||
func (s EventsService) Resources() usecase.IOInteractor { | ||
panic("implement me") | ||
// s.q.GetResourceList(context.TODO(), "") | ||
} | ||
|
||
func (s EventsService) PostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) BatchPostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) Resource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) PostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) BatchPostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s EventsService) DeleteResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} |
File renamed without changes.
149 changes: 75 additions & 74 deletions
149
internal/api/services/resources_service.go → internal/api/services/resources/service.go
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 |
---|---|---|
@@ -1,74 +1,75 @@ | ||
package services | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/swaggest/usecase" | ||
"github.com/swaggest/usecase/status" | ||
|
||
"github.com/acmcsufoss/api.acmcsuf.com/internal/db/sqlite" | ||
) | ||
|
||
var _ Service = ResourcesService{} | ||
|
||
type ResourcesService struct { | ||
q *sqlite.Queries | ||
} | ||
|
||
func NewResourcesService(q *sqlite.Queries) *ResourcesService { | ||
return &ResourcesService{q} | ||
} | ||
|
||
type resourceInput struct { | ||
Title string `json:"title"` | ||
ContentMd string `json:"content_md"` | ||
ImageUrl string `json:"image_url"` | ||
ResourceType string `json:"resource_type"` | ||
ResourceListID string `json:"resource_list_id"` | ||
} | ||
|
||
type resourceOutput sqlite.Resource | ||
|
||
func (s ResourcesService) Resources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) PostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) BatchPostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) Resource() usecase.IOInteractor { | ||
// Create use case interactor with references to input/output types and interaction function. | ||
u := usecase.NewIOI(new(resourceInput), new(resourceOutput), func(ctx context.Context, input, output interface{}) error { | ||
// var ( | ||
// in = input.(*resourceInput) | ||
// out = output.(*resourceOutput) | ||
// ) | ||
|
||
// TODO: Get resource by ID from database. | ||
|
||
return nil | ||
}) | ||
|
||
// Describe use case interactor. | ||
u.SetTitle("GetResource") | ||
u.SetDescription("Gets a single base resource.") | ||
u.SetExpectedErrors(status.InvalidArgument) | ||
return u | ||
} | ||
|
||
func (s ResourcesService) PostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) BatchPostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) DeleteResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
package resources | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/swaggest/usecase" | ||
"github.com/swaggest/usecase/status" | ||
|
||
"github.com/acmcsufoss/api.acmcsuf.com/internal/api/services" | ||
"github.com/acmcsufoss/api.acmcsuf.com/internal/db/sqlite" | ||
) | ||
|
||
var _ services.Service = ResourcesService{} | ||
|
||
type ResourcesService struct { | ||
q *sqlite.Queries | ||
} | ||
|
||
func New(q *sqlite.Queries) *ResourcesService { | ||
return &ResourcesService{q} | ||
} | ||
|
||
type resourceInput struct { | ||
Title string `json:"title"` | ||
ContentMd string `json:"content_md"` | ||
ImageUrl string `json:"image_url"` | ||
ResourceType string `json:"resource_type"` | ||
ResourceListID string `json:"resource_list_id"` | ||
} | ||
|
||
type resourceOutput sqlite.Resource | ||
|
||
func (s ResourcesService) Resources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) PostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) BatchPostResources() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) Resource() usecase.IOInteractor { | ||
// Create use case interactor with references to input/output types and interaction function. | ||
u := usecase.NewIOI(new(resourceInput), new(resourceOutput), func(ctx context.Context, input, output interface{}) error { | ||
// var ( | ||
// in = input.(*resourceInput) | ||
// out = output.(*resourceOutput) | ||
// ) | ||
|
||
// TODO: Get resource by ID from database. | ||
|
||
return nil | ||
}) | ||
|
||
// Describe use case interactor. | ||
u.SetTitle("GetResource") | ||
u.SetDescription("Gets a single base resource.") | ||
u.SetExpectedErrors(status.InvalidArgument) | ||
return u | ||
} | ||
|
||
func (s ResourcesService) PostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) BatchPostResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} | ||
|
||
func (s ResourcesService) DeleteResource() usecase.IOInteractor { | ||
panic("implement me") | ||
} |