diff --git a/app/module/popup_news_content_images/popup_news_content_images.module.go b/app/module/popup_news_content_images/popup_news_content_images.module.go new file mode 100644 index 0000000..a8e136e --- /dev/null +++ b/app/module/popup_news_content_images/popup_news_content_images.module.go @@ -0,0 +1,51 @@ +package popup_news_content_images + +import ( + "web-qudo-be/app/module/popup_news_content_images/controller" + "web-qudo-be/app/module/popup_news_content_images/repository" + "web-qudo-be/app/module/popup_news_content_images/service" + + "github.com/gofiber/fiber/v2" + "go.uber.org/fx" +) + +// struct of PopupNewsContentImagesRouter +type PopupNewsContentImagesRouter struct { + App fiber.Router + Controller *controller.Controller +} + +// register bulky of module +var NewPopupNewsContentImagesModule = fx.Options( + // register repository + fx.Provide(repository.NewPopupNewsContentImagesRepository), + + // register service + fx.Provide(service.NewPopupNewsContentImagesService), + + // register controller + fx.Provide(controller.NewController), + + // register router + fx.Provide(NewPopupNewsContentImagesRouter), +) + +// init router +func NewPopupNewsContentImagesRouter(fiber *fiber.App, controller *controller.Controller) *PopupNewsContentImagesRouter { + return &PopupNewsContentImagesRouter{ + App: fiber, + Controller: controller, + } +} + +// register routes +func (_i *PopupNewsContentImagesRouter) RegisterPopupNewsContentImagesRoutes() { + popupNewsContentImagesController := _i.Controller.PopupNewsContent + + _i.App.Route("/popup-news-content-images", func(router fiber.Router) { + + router.Post("/", popupNewsContentImagesController.Save) + + router.Delete("/:id", popupNewsContentImagesController.Delete) + }) +} \ No newline at end of file diff --git a/app/module/popup_news_contents/popup_news_contents.module.go b/app/module/popup_news_contents/popup_news_contents.module.go new file mode 100644 index 0000000..79e7629 --- /dev/null +++ b/app/module/popup_news_contents/popup_news_contents.module.go @@ -0,0 +1,52 @@ +package popup_news_contents + +import ( + "web-qudo-be/app/module/popup_news_contents/controller" + "web-qudo-be/app/module/popup_news_contents/repository" + "web-qudo-be/app/module/popup_news_contents/service" + + "github.com/gofiber/fiber/v2" + "go.uber.org/fx" +) + +// struct of PopupNewsContentsRouter +type PopupNewsContentsRouter struct { + App fiber.Router + Controller *controller.Controller +} + +// register bulky of PopupNewsContents module +var NewPopupNewsContentsModule = fx.Options( + // register repository + fx.Provide(repository.NewPopupNewsContentsRepository), + + // register service + fx.Provide(service.NewPopupNewsContentsService), + + // register controller + fx.Provide(controller.NewController), + + // register router + fx.Provide(NewPopupNewsContentsRouter), +) + +// init router +func NewPopupNewsContentsRouter(fiber *fiber.App, controller *controller.Controller) *PopupNewsContentsRouter { + return &PopupNewsContentsRouter{ + App: fiber, + Controller: controller, + } +} + +// register routes +func (_i *PopupNewsContentsRouter) RegisterPopupNewsContentsRoutes() { + popupNewsContentsController := _i.Controller.PopupNewsContent + + _i.App.Route("/popup-news-contents", func(router fiber.Router) { + router.Get("/", popupNewsContentsController.All) + router.Get("/:id", popupNewsContentsController.Show) + router.Post("/", popupNewsContentsController.Save) + router.Put("/:id", popupNewsContentsController.Update) + router.Delete("/:id", popupNewsContentsController.Delete) + }) +} \ No newline at end of file diff --git a/app/router/api.go b/app/router/api.go index c425d3f..1c38c98 100644 --- a/app/router/api.go +++ b/app/router/api.go @@ -34,6 +34,8 @@ import ( "web-qudo-be/app/module/our_service_content_images" "web-qudo-be/app/module/our_service_contents" "web-qudo-be/app/module/partner_contents" + "web-qudo-be/app/module/popup_news_content_images" + "web-qudo-be/app/module/popup_news_contents" "web-qudo-be/app/module/provinces" "web-qudo-be/app/module/schedules" "web-qudo-be/app/module/subscription" @@ -83,6 +85,8 @@ type Router struct { OurProductContentImagesRouter *our_product_content_images.OurProductContentImagesRouter OurServiceContentRouter *our_service_contents.OurServiceContentsRouter OurServiceContentImagesRouter *our_service_content_images.OurServiceContentImagesRouter + PopUpNewsContentsRouter *popup_news_contents.PopupNewsContentsRouter + PopUpNewsContentImagesRouter *popup_news_content_images.PopupNewsContentImagesRouter ProvincesRouter *provinces.ProvincesRouter SchedulesRouter *schedules.SchedulesRouter SubscriptionRouter *subscription.SubscriptionRouter @@ -129,6 +133,8 @@ func NewRouter( ourServiceContentsRouter *our_service_contents.OurServiceContentsRouter, ourServiceContentImagesRouter *our_service_content_images.OurServiceContentImagesRouter, partnerContentsRouter *partner_contents.PartnerContentsRouter, + popUpNewsContentsRouter *popup_news_contents.PopupNewsContentsRouter, + popUpNewsContentImagesRouter *popup_news_content_images.PopupNewsContentImagesRouter, provincesRouter *provinces.ProvincesRouter, schedulesRouter *schedules.SchedulesRouter, subscriptionRouter *subscription.SubscriptionRouter, @@ -173,6 +179,8 @@ func NewRouter( OurServiceContentRouter: ourServiceContentsRouter, OurServiceContentImagesRouter: ourServiceContentImagesRouter, PartnerContentRouter: partnerContentsRouter, + PopUpNewsContentsRouter: popUpNewsContentsRouter, + PopUpNewsContentImagesRouter: popUpNewsContentImagesRouter, ProvincesRouter: provincesRouter, SchedulesRouter: schedulesRouter, SubscriptionRouter: subscriptionRouter, @@ -227,6 +235,8 @@ func (r *Router) Register() { r.OurServiceContentRouter.RegisterOurServiceContentsRoutes() r.OurServiceContentImagesRouter.RegisterOurServiceContentImagesRoutes() r.PartnerContentRouter.RegisterPartnerContentsRoutes() + r.PopUpNewsContentsRouter.RegisterPopupNewsContentsRoutes() + r.PopUpNewsContentImagesRouter.RegisterPopupNewsContentImagesRoutes() r.ProvincesRouter.RegisterProvincesRoutes() r.SchedulesRouter.RegisterSchedulesRoutes() r.SubscriptionRouter.RegisterSubscriptionRoutes() diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 1c7ffd8..23e8a76 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -12707,6 +12707,346 @@ const docTemplate = `{ } } } + }, + "/popup-news-content-images": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for uploading image for Popup News Content", + "tags": [ + "Popup News Content Images" + ], + "summary": "Upload Popup News Content Image", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/popup-news-content-images/{id}": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for deleting image", + "tags": [ + "Popup News Content Images" + ], + "summary": "Delete Popup News Content Image", + "parameters": [ + { + "type": "integer", + "description": "Image ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/popup-news-contents": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting all Popup News Contents", + "tags": [ + "Popup News Contents" + ], + "summary": "Get all Popup News Contents", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for create Popup News Content", + "tags": [ + "Popup News Contents" + ], + "summary": "Create Popup News Content", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/popup-news-contents/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting one Popup News Content", + "tags": [ + "Popup News Contents" + ], + "summary": "Get one Popup News Content", + "parameters": [ + { + "type": "integer", + "description": "Popup News Content ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for update Popup News Content", + "tags": [ + "Popup News Contents" + ], + "summary": "Update Popup News Content", + "parameters": [ + { + "type": "integer", + "description": "Popup News Content ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for delete Popup News Content", + "tags": [ + "Popup News Contents" + ], + "summary": "Delete Popup News Content", + "parameters": [ + { + "type": "integer", + "description": "Popup News Content ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } }, "/provinces": { "get": { diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 00b1c37..845b567 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -12682,6 +12682,332 @@ } } }, + "/popup-news-content-images": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for uploading image for Popup News Content", + "tags": ["Popup News Content Images"], + "summary": "Upload Popup News Content Image", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/popup-news-content-images/{id}": { + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for deleting image", + "tags": ["Popup News Content Images"], + "summary": "Delete Popup News Content Image", + "parameters": [ + { + "type": "integer", + "description": "Image ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/popup-news-contents": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting all Popup News Contents", + "tags": ["Popup News Contents"], + "summary": "Get all Popup News Contents", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for create Popup News Content", + "tags": ["Popup News Contents"], + "summary": "Create Popup News Content", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/popup-news-contents/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting one Popup News Content", + "tags": ["Popup News Contents"], + "summary": "Get one Popup News Content", + "parameters": [ + { + "type": "integer", + "description": "Popup News Content ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for update Popup News Content", + "tags": ["Popup News Contents"], + "summary": "Update Popup News Content", + "parameters": [ + { + "type": "integer", + "description": "Popup News Content ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for delete Popup News Content", + "tags": ["Popup News Contents"], + "summary": "Delete Popup News Content", + "parameters": [ + { + "type": "integer", + "description": "Popup News Content ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "422": { + "description": "Unprocessable Entity", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/provinces": { "get": { "security": [ diff --git a/main.go b/main.go index 1e71b49..68c3207 100644 --- a/main.go +++ b/main.go @@ -37,6 +37,8 @@ import ( "web-qudo-be/app/module/our_service_content_images" "web-qudo-be/app/module/our_service_contents" "web-qudo-be/app/module/partner_contents" + "web-qudo-be/app/module/popup_news_content_images" + "web-qudo-be/app/module/popup_news_contents" "web-qudo-be/app/module/provinces" "web-qudo-be/app/module/schedules" "web-qudo-be/app/module/subscription" @@ -116,6 +118,8 @@ func main() { our_service_contents.NewOurServiceContentsModule, our_service_content_images.NewOurServiceContentImagesModule, partner_contents.NewPartnerContentsModule, + popup_news_contents.NewPopupNewsContentsModule, + popup_news_content_images.NewPopupNewsContentImagesModule, provinces.NewProvincesModule, schedules.NewSchedulesModule, subscription.NewSubscriptionModule,