From 974daf4c258bab818317360f409ebe50fc818b31 Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Sat, 20 Sep 2025 09:45:59 +0700 Subject: [PATCH] feat: update ai chat and update user data --- app/database/entity/ai_chat_logs.entity.go | 20 +- .../entity/ai_chat_messages.entity.go | 12 +- .../entity/ai_chat_sessions.entity.go | 6 +- app/database/entity/chat_messages.entity.go | 26 +- app/database/entity/chat_sessions.entity.go | 21 +- .../controller/activity_logs.controller.go | 20 +- .../controller/advertisement.controller.go | 26 +- app/module/ai_chat/ai_chat.module.go | 8 +- .../ai_chat/controller/ai_chat.controller.go | 62 +- app/module/ai_chat/mapper/ai_chat.mapper.go | 5 +- .../ai_chat/repository/ai_chat.repository.go | 44 +- app/module/ai_chat/request/ai_chat.request.go | 31 +- .../ai_chat/response/ai_chat.response.go | 9 +- app/module/ai_chat/service/ai_chat.service.go | 83 +- .../article_approvals.controller.go | 5 +- .../article_categories.controller.go | 27 +- .../controller/article_comments.controller.go | 25 +- .../controller/article_files.controller.go | 20 +- .../controller/articles.controller.go | 26 +- .../chat_history/chat_history.module.go | 64 - .../controller/chat_history.controller.go | 424 ---- .../mapper/chat_history.mapper.go | 77 - .../repository/chat_history.repository.go | 159 -- .../request/chat_history.request.go | 131 -- .../response/chat_history.response.go | 39 - .../service/chat_history.service.go | 317 --- .../custom_static_pages.controller.go | 20 +- .../education_history.controller.go | 6 - .../controller/feedbacks.controller.go | 6 - .../controller/magazines.controller.go | 7 - .../research_journals.controller.go | 5 - .../controller/subscription.controller.go | 5 - .../users/controller/users.controller.go | 11 - .../controller/work_history.controller.go | 5 - app/router/api.go | 5 - docs/swagger/docs.go | 1895 +++-------------- docs/swagger/swagger.json | 1895 +++-------------- docs/swagger/swagger.yaml | 1040 +-------- main.go | 2 - plan/code-templates.md | 3 - scripts/migrate.go | 38 - 41 files changed, 799 insertions(+), 5831 deletions(-) delete mode 100644 app/module/chat_history/chat_history.module.go delete mode 100644 app/module/chat_history/controller/chat_history.controller.go delete mode 100644 app/module/chat_history/mapper/chat_history.mapper.go delete mode 100644 app/module/chat_history/repository/chat_history.repository.go delete mode 100644 app/module/chat_history/request/chat_history.request.go delete mode 100644 app/module/chat_history/response/chat_history.response.go delete mode 100644 app/module/chat_history/service/chat_history.service.go delete mode 100644 scripts/migrate.go diff --git a/app/database/entity/ai_chat_logs.entity.go b/app/database/entity/ai_chat_logs.entity.go index 605f418..9d8cdfe 100644 --- a/app/database/entity/ai_chat_logs.entity.go +++ b/app/database/entity/ai_chat_logs.entity.go @@ -6,14 +6,14 @@ import ( ) type AIChatLogs struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - SessionID uint `json:"session_id" gorm:"type:int4;not null;index"` - UserID uint `json:"user_id" gorm:"type:int4;not null;index"` - StartDate time.Time `json:"start_date" gorm:"not null"` - EndDate *time.Time `json:"end_date"` - TotalDuration int64 `json:"total_duration" gorm:"type:bigint;default:0"` - CreatedAt time.Time `json:"created_at" gorm:"default:now()"` - UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` - Session *AIChatSessions `json:"session" gorm:"foreignKey:SessionID;references:ID"` - User *users.Users `json:"user" gorm:"foreignKey:UserID;references:ID"` + ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` + SessionID uint `json:"session_id" gorm:"type:int4;not null;index"` + UserID uint `json:"user_id" gorm:"type:int4;not null;index"` + StartDate time.Time `json:"start_date" gorm:"not null"` + EndDate *time.Time `json:"end_date"` + TotalDuration int64 `json:"total_duration" gorm:"type:bigint;default:0"` + CreatedAt time.Time `json:"created_at" gorm:"default:now()"` + UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` + User *users.Users `json:"user" gorm:"foreignKey:UserID;references:ID"` } + diff --git a/app/database/entity/ai_chat_messages.entity.go b/app/database/entity/ai_chat_messages.entity.go index 414dc77..d35062e 100644 --- a/app/database/entity/ai_chat_messages.entity.go +++ b/app/database/entity/ai_chat_messages.entity.go @@ -5,10 +5,10 @@ import ( ) type AIChatMessages struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - SessionID uint `json:"session_id" gorm:"type:int4;not null;index"` - MessageType string `json:"message_type" gorm:"type:varchar;not null"` - Content string `json:"content" gorm:"type:text;not null"` - CreatedAt time.Time `json:"created_at" gorm:"default:now()"` - Session *AIChatSessions `json:"session" gorm:"foreignKey:SessionID;references:ID"` + ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` + SessionID string `json:"session_id" gorm:"type:varchar;not null;index"` + MessageType string `json:"message_type" gorm:"type:varchar;not null"` + Content string `json:"content" gorm:"type:text;not null"` + IsActive bool `json:"is_active" gorm:"type:bool;default:true"` + CreatedAt time.Time `json:"created_at" gorm:"default:now()"` } diff --git a/app/database/entity/ai_chat_sessions.entity.go b/app/database/entity/ai_chat_sessions.entity.go index 8250f1e..dd1bcc4 100644 --- a/app/database/entity/ai_chat_sessions.entity.go +++ b/app/database/entity/ai_chat_sessions.entity.go @@ -7,12 +7,12 @@ import ( type AIChatSessions struct { ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - AISessionID string `json:"ai_session_id" gorm:"type:varchar;not null;unique"` + SessionID string `json:"session_id" gorm:"type:varchar;not null;unique;index"` UserID uint `json:"user_id" gorm:"type:int4;not null;index"` - AgentID *string `json:"agent_id" gorm:"type:varchar"` + AgentID string `json:"agent_id" gorm:"type:varchar;not null"` Title string `json:"title" gorm:"type:varchar;not null"` MessageCount int `json:"message_count" gorm:"type:int4;default:0"` - Status string `json:"status" gorm:"type:varchar;default:'active'"` + IsActive bool `json:"is_active" gorm:"type:bool;default:true"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` User *users.Users `json:"user" gorm:"foreignKey:UserID;references:ID"` diff --git a/app/database/entity/chat_messages.entity.go b/app/database/entity/chat_messages.entity.go index 005a81e..9427e48 100644 --- a/app/database/entity/chat_messages.entity.go +++ b/app/database/entity/chat_messages.entity.go @@ -6,16 +6,18 @@ import ( ) type ChatMessages struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - ConversationID uint `json:"conversation_id" gorm:"type:int4;not null;index"` - SenderID uint `json:"sender_id" gorm:"type:int4;not null;index"` - MessageText *string `json:"message_text" gorm:"type:text"` - MessageType string `json:"message_type" gorm:"type:varchar;not null;default:'text'"` - FileURL *string `json:"file_url" gorm:"type:varchar"` - FileName *string `json:"file_name" gorm:"type:varchar"` - FileSize *int64 `json:"file_size" gorm:"type:bigint"` - IsRead bool `json:"is_read" gorm:"default:false"` - CreatedAt time.Time `json:"created_at" gorm:"default:now()"` - Conversation *Conversations `json:"conversation" gorm:"foreignKey:ConversationID;references:ID"` - Sender *users.Users `json:"sender" gorm:"foreignKey:SenderID;references:ID"` + ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` + ConversationID uint `json:"conversation_id" gorm:"type:int4;not null;index"` + SenderID uint `json:"sender_id" gorm:"type:int4;not null;index"` + MessageText *string `json:"message_text" gorm:"type:text"` + MessageType string `json:"message_type" gorm:"type:varchar;not null;default:'text'"` + FileURL *string `json:"file_url" gorm:"type:varchar"` + FileName *string `json:"file_name" gorm:"type:varchar"` + FileSize *int64 `json:"file_size" gorm:"type:bigint"` + IsRead bool `json:"is_read" gorm:"default:false"` + IsActive bool `json:"is_active" gorm:"type:bool;default:true"` + CreatedAt time.Time `json:"created_at" gorm:"default:now()"` + UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` + // Conversation *Conversations `json:"conversation" gorm:"foreignKey:ConversationID;references:ID"` + Sender *users.Users `json:"sender" gorm:"foreignKey:SenderID;references:ID"` } diff --git a/app/database/entity/chat_sessions.entity.go b/app/database/entity/chat_sessions.entity.go index 2c29b5f..962bbf6 100644 --- a/app/database/entity/chat_sessions.entity.go +++ b/app/database/entity/chat_sessions.entity.go @@ -6,15 +6,14 @@ import ( ) type ChatSessions struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - SessionID string `json:"session_id" gorm:"type:varchar;not null;unique;index"` - UserID uint `json:"user_id" gorm:"type:int4;not null;index"` - AgentID string `json:"agent_id" gorm:"type:varchar;not null"` - Title string `json:"title" gorm:"type:varchar;not null"` - MessageCount int `json:"message_count" gorm:"type:int4;default:0"` - Status string `json:"status" gorm:"type:varchar;default:'active'"` - CreatedAt time.Time `json:"created_at" gorm:"default:now()"` - UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` - User *users.Users `json:"user" gorm:"foreignKey:UserID;references:ID"` - Messages []ChatMessages `json:"messages" gorm:"foreignKey:SessionID;references:SessionID"` + ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` + SessionID string `json:"session_id" gorm:"type:varchar;not null;unique;index"` + UserID uint `json:"user_id" gorm:"type:int4;not null;index"` + AgentID string `json:"agent_id" gorm:"type:varchar;not null"` + Title string `json:"title" gorm:"type:varchar;not null"` + MessageCount int `json:"message_count" gorm:"type:int4;default:0"` + IsActive bool `json:"is_active" gorm:"type:bool;default:true"` + CreatedAt time.Time `json:"created_at" gorm:"default:now()"` + UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` + User *users.Users `json:"user" gorm:"foreignKey:UserID;references:ID"` } diff --git a/app/module/activity_logs/controller/activity_logs.controller.go b/app/module/activity_logs/controller/activity_logs.controller.go index 74acbfa..17ace03 100644 --- a/app/module/activity_logs/controller/activity_logs.controller.go +++ b/app/module/activity_logs/controller/activity_logs.controller.go @@ -1,7 +1,7 @@ package controller import ( - "narasi-ahli-be/app/module/activity_logs/request" + "narasi-ahli-be/app/module/activity_logs/request" "narasi-ahli-be/app/module/activity_logs/service" "narasi-ahli-be/utils/paginator" utilRes "narasi-ahli-be/utils/response" @@ -39,7 +39,6 @@ func NewActivityLogsController(activityLogsService service.ActivityLogsService, // @Description API for getting all ActivityLogs // @Tags ActivityLogs // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.ActivityLogsQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -53,7 +52,7 @@ func (_i *activityLogsController) All(c *fiber.Ctx) error { return err } - reqContext := request.ActivityLogsQueryRequestContext{ + reqContext := request.ActivityLogsQueryRequestContext{ ActivityTypeId: c.Query("activityTypeId"), Url: c.Query("url"), ArticleId: c.Query("articleId"), @@ -80,7 +79,6 @@ func (_i *activityLogsController) All(c *fiber.Ctx) error { // @Description API for getting one ActivityLogs // @Tags ActivityLogs // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "ActivityLogs ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -93,7 +91,7 @@ func (_i *activityLogsController) Show(c *fiber.Ctx) error { return err } - activityLogsData, err := _i.activityLogsService.Show(uint(id)) + activityLogsData, err := _i.activityLogsService.Show(uint(id)) if err != nil { return err } @@ -110,7 +108,6 @@ func (_i *activityLogsController) Show(c *fiber.Ctx) error { // @Description API for create ActivityLogs // @Tags ActivityLogs // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.ActivityLogsCreateRequest true "Required payload" @@ -125,7 +122,7 @@ func (_i *activityLogsController) Save(c *fiber.Ctx) error { return err } - var authToken *string + var authToken *string getTokenFromHeader := c.Get("Authorization") if getTokenFromHeader == "" { authToken = nil @@ -151,7 +148,6 @@ func (_i *activityLogsController) Save(c *fiber.Ctx) error { // @Description API for update ActivityLogs // @Tags ActivityLogs // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.ActivityLogsUpdateRequest true "Required payload" // @Param id path int true "ActivityLogs ID" @@ -171,7 +167,7 @@ func (_i *activityLogsController) Update(c *fiber.Ctx) error { return err } - err = _i.activityLogsService.Update(uint(id), *req) + err = _i.activityLogsService.Update(uint(id), *req) if err != nil { return err } @@ -187,7 +183,6 @@ func (_i *activityLogsController) Update(c *fiber.Ctx) error { // @Description API for delete ActivityLogs // @Tags ActivityLogs // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "ActivityLogs ID" // @Success 200 {object} response.Response @@ -201,7 +196,7 @@ func (_i *activityLogsController) Delete(c *fiber.Ctx) error { return err } - err = _i.activityLogsService.Delete(uint(id)) + err = _i.activityLogsService.Delete(uint(id)) if err != nil { return err } @@ -217,7 +212,6 @@ func (_i *activityLogsController) Delete(c *fiber.Ctx) error { // @Description API for get activity stats ActivityLogs // @Tags ActivityLogs // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError // @Failure 401 {object} response.UnauthorizedError @@ -226,7 +220,7 @@ func (_i *activityLogsController) Delete(c *fiber.Ctx) error { func (_i *activityLogsController) GetActivityStats(c *fiber.Ctx) error { _i.Log.Info().Interface("GetActivityStats", "checker controller").Msg("") - activityStatsData, err := _i.activityLogsService.GetActivityStats() + activityStatsData, err := _i.activityLogsService.GetActivityStats() if err != nil { return err } diff --git a/app/module/advertisement/controller/advertisement.controller.go b/app/module/advertisement/controller/advertisement.controller.go index eaa8ec5..59ae9bc 100644 --- a/app/module/advertisement/controller/advertisement.controller.go +++ b/app/module/advertisement/controller/advertisement.controller.go @@ -1,7 +1,7 @@ package controller import ( - "narasi-ahli-be/app/module/advertisement/request" + "narasi-ahli-be/app/module/advertisement/request" "narasi-ahli-be/app/module/advertisement/service" "narasi-ahli-be/utils/paginator" "strconv" @@ -41,7 +41,6 @@ func NewAdvertisementController(advertisementService service.AdvertisementServic // @Description API for getting all Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.AdvertisementQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -55,7 +54,7 @@ func (_i *advertisementController) All(c *fiber.Ctx) error { return err } - reqContext := request.AdvertisementQueryRequestContext{ + reqContext := request.AdvertisementQueryRequestContext{ Title: c.Query("title"), Description: c.Query("description"), RedirectLink: c.Query("redirectLink"), @@ -83,7 +82,6 @@ func (_i *advertisementController) All(c *fiber.Ctx) error { // @Description API for getting one Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Advertisement ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -96,7 +94,7 @@ func (_i *advertisementController) Show(c *fiber.Ctx) error { return err } - advertisementData, err := _i.advertisementService.Show(uint(id)) + advertisementData, err := _i.advertisementService.Show(uint(id)) if err != nil { return err } @@ -113,7 +111,6 @@ func (_i *advertisementController) Show(c *fiber.Ctx) error { // @Description API for create Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.AdvertisementCreateRequest true "Required payload" @@ -128,7 +125,7 @@ func (_i *advertisementController) Save(c *fiber.Ctx) error { return err } - dataResult, err := _i.advertisementService.Save(*req) + dataResult, err := _i.advertisementService.Save(*req) if err != nil { return err } @@ -146,7 +143,6 @@ func (_i *advertisementController) Save(c *fiber.Ctx) error { // @Tags Advertisement // @Security Bearer // @Produce json -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param file formData file true "Upload file" multiple false // @Param id path int true "Advertisement ID" @@ -161,7 +157,7 @@ func (_i *advertisementController) Upload(c *fiber.Ctx) error { return err } - err = _i.advertisementService.Upload(c, uint(id)) + err = _i.advertisementService.Upload(c, uint(id)) if err != nil { return err } @@ -177,7 +173,6 @@ func (_i *advertisementController) Upload(c *fiber.Ctx) error { // @Description API for update Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.AdvertisementUpdateRequest true "Required payload" // @Param id path int true "Advertisement ID" @@ -197,7 +192,7 @@ func (_i *advertisementController) Update(c *fiber.Ctx) error { return err } - err = _i.advertisementService.Update(uint(id), *req) + err = _i.advertisementService.Update(uint(id), *req) if err != nil { return err } @@ -213,7 +208,6 @@ func (_i *advertisementController) Update(c *fiber.Ctx) error { // @Description API for Update Publish Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param id path int true "Advertisement ID" @@ -234,7 +228,7 @@ func (_i *advertisementController) UpdatePublish(c *fiber.Ctx) error { return err } - err = _i.advertisementService.UpdatePublish(uint(id), isPublish) + err = _i.advertisementService.UpdatePublish(uint(id), isPublish) if err != nil { return err } @@ -250,7 +244,6 @@ func (_i *advertisementController) UpdatePublish(c *fiber.Ctx) error { // @Description API for delete Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Advertisement ID" // @Success 200 {object} response.Response @@ -264,7 +257,7 @@ func (_i *advertisementController) Delete(c *fiber.Ctx) error { return err } - err = _i.advertisementService.Delete(uint(id)) + err = _i.advertisementService.Delete(uint(id)) if err != nil { return err } @@ -280,7 +273,6 @@ func (_i *advertisementController) Delete(c *fiber.Ctx) error { // @Description API for Viewer Advertisement // @Tags Advertisement // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param filename path string true "Content File Name" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -288,5 +280,5 @@ func (_i *advertisementController) Delete(c *fiber.Ctx) error { // @Failure 500 {object} response.InternalServerError // @Router /advertisement/viewer/{filename} [get] func (_i *advertisementController) Viewer(c *fiber.Ctx) error { - return _i.advertisementService.Viewer(c) + return _i.advertisementService.Viewer(c) } diff --git a/app/module/ai_chat/ai_chat.module.go b/app/module/ai_chat/ai_chat.module.go index 8e5e70f..e83e886 100644 --- a/app/module/ai_chat/ai_chat.module.go +++ b/app/module/ai_chat/ai_chat.module.go @@ -53,10 +53,10 @@ func (_i *AIChatRouter) RegisterAIChatRoutes() { router.Delete("/sessions/:id", aiChatController.DeleteSession) // Messages routes - router.Get("/sessions/:sessionId/messages", aiChatController.GetSessionMessages) - router.Post("/sessions/:sessionId/messages", aiChatController.SendMessage) - router.Put("/sessions/:sessionId/messages/:messageId", aiChatController.UpdateMessage) - router.Delete("/sessions/:sessionId/messages/:messageId", aiChatController.DeleteMessage) + router.Get("/sessions/messages", aiChatController.GetSessionMessages) + router.Post("/sessions/messages", aiChatController.SendMessage) + router.Put("/sessions/messages/:messageId", aiChatController.UpdateMessage) + router.Delete("/sessions/messages/:messageId", aiChatController.DeleteMessage) // Logs routes router.Get("/logs", aiChatController.GetUserLogs) diff --git a/app/module/ai_chat/controller/ai_chat.controller.go b/app/module/ai_chat/controller/ai_chat.controller.go index 698c26b..45027dd 100644 --- a/app/module/ai_chat/controller/ai_chat.controller.go +++ b/app/module/ai_chat/controller/ai_chat.controller.go @@ -48,7 +48,7 @@ func NewAIChatController(aiChatService service.AIChatService, log zerolog.Logger // @Description API for getting all AI chat sessions for authenticated user // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param req query request.AIChatSessionsQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -65,7 +65,7 @@ func (_i *aiChatController) GetUserSessions(c *fiber.Ctx) error { authHeader := c.Get("Authorization") reqContext := request.AIChatSessionsQueryRequestContext{ - Status: c.Query("status"), + IsActive: c.Query("isActive"), } req := reqContext.ToParamRequest() req.Pagination = paginate @@ -88,7 +88,7 @@ func (_i *aiChatController) GetUserSessions(c *fiber.Ctx) error { // @Description API for getting one AI chat session // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param id path int true "Session ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -120,7 +120,6 @@ func (_i *aiChatController) GetSession(c *fiber.Ctx) error { // @Description API for create AI chat session // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.AIChatSessionsCreateRequest true "Required payload" @@ -154,7 +153,7 @@ func (_i *aiChatController) CreateSession(c *fiber.Ctx) error { // @Description API for update AI chat session // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Session ID" // @Param payload body request.AIChatSessionsUpdateRequest true "Required payload" @@ -192,7 +191,7 @@ func (_i *aiChatController) UpdateSession(c *fiber.Ctx) error { // @Description API for delete AI chat session // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Session ID" // @Success 200 {object} response.Response @@ -224,7 +223,7 @@ func (_i *aiChatController) DeleteSession(c *fiber.Ctx) error { // @Description API for getting all messages in an AI chat session // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param sessionId path int true "Session ID" // @Param req query request.AIChatMessagesQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" @@ -234,10 +233,7 @@ func (_i *aiChatController) DeleteSession(c *fiber.Ctx) error { // @Failure 500 {object} response.InternalServerError // @Router /ai-chat/sessions/{sessionId}/messages [get] func (_i *aiChatController) GetSessionMessages(c *fiber.Ctx) error { - sessionId, err := strconv.ParseUint(c.Params("sessionId"), 10, 0) - if err != nil { - return err - } + sessionId := c.Params("sessionId") paginate, err := paginator.Paginate(c) if err != nil { @@ -247,12 +243,12 @@ func (_i *aiChatController) GetSessionMessages(c *fiber.Ctx) error { authHeader := c.Get("Authorization") reqContext := request.AIChatMessagesQueryRequestContext{ - SessionID: c.Query("sessionId"), + SessionID: sessionId, } req := reqContext.ToParamRequest() req.Pagination = paginate - messagesData, paging, err := _i.aiChatService.GetSessionMessages(authHeader, uint(sessionId), req) + messagesData, paging, err := _i.aiChatService.GetSessionMessages(authHeader, sessionId, req) if err != nil { return err } @@ -270,21 +266,15 @@ func (_i *aiChatController) GetSessionMessages(c *fiber.Ctx) error { // @Description API for sending a message to an AI chat session // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param sessionId path int true "Session ID" // @Param payload body request.AIChatMessagesCreateRequest true "Required payload" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError // @Failure 401 {object} response.UnauthorizedError // @Failure 500 {object} response.InternalServerError -// @Router /ai-chat/sessions/{sessionId}/messages [post] +// @Router /ai-chat/sessions/messages [post] func (_i *aiChatController) SendMessage(c *fiber.Ctx) error { - sessionId, err := strconv.ParseUint(c.Params("sessionId"), 10, 0) - if err != nil { - return err - } - req := new(request.AIChatMessagesCreateRequest) if err := utilVal.ParseAndValidate(c, req); err != nil { return err @@ -292,7 +282,7 @@ func (_i *aiChatController) SendMessage(c *fiber.Ctx) error { authHeader := c.Get("Authorization") - dataResult, err := _i.aiChatService.SendMessage(authHeader, uint(sessionId), *req) + dataResult, err := _i.aiChatService.SendMessage(authHeader, *req) if err != nil { return err } @@ -309,22 +299,16 @@ func (_i *aiChatController) SendMessage(c *fiber.Ctx) error { // @Description API for update AI chat message // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param sessionId path int true "Session ID" // @Param messageId path int true "Message ID" // @Param payload body request.AIChatMessagesUpdateRequest true "Required payload" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError // @Failure 401 {object} response.UnauthorizedError // @Failure 500 {object} response.InternalServerError -// @Router /ai-chat/sessions/{sessionId}/messages/{messageId} [put] +// @Router /ai-chat/sessions/messages/{messageId} [put] func (_i *aiChatController) UpdateMessage(c *fiber.Ctx) error { - sessionId, err := strconv.ParseUint(c.Params("sessionId"), 10, 0) - if err != nil { - return err - } - messageId, err := strconv.ParseUint(c.Params("messageId"), 10, 0) if err != nil { return err @@ -337,7 +321,7 @@ func (_i *aiChatController) UpdateMessage(c *fiber.Ctx) error { authHeader := c.Get("Authorization") - err = _i.aiChatService.UpdateMessage(authHeader, uint(sessionId), uint(messageId), *req) + err = _i.aiChatService.UpdateMessage(authHeader, uint(messageId), *req) if err != nil { return err } @@ -353,21 +337,15 @@ func (_i *aiChatController) UpdateMessage(c *fiber.Ctx) error { // @Description API for delete AI chat message // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param sessionId path int true "Session ID" // @Param messageId path int true "Message ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError // @Failure 401 {object} response.UnauthorizedError // @Failure 500 {object} response.InternalServerError -// @Router /ai-chat/sessions/{sessionId}/messages/{messageId} [delete] +// @Router /ai-chat/sessions/messages/{messageId} [delete] func (_i *aiChatController) DeleteMessage(c *fiber.Ctx) error { - sessionId, err := strconv.ParseUint(c.Params("sessionId"), 10, 0) - if err != nil { - return err - } - messageId, err := strconv.ParseUint(c.Params("messageId"), 10, 0) if err != nil { return err @@ -375,7 +353,7 @@ func (_i *aiChatController) DeleteMessage(c *fiber.Ctx) error { authHeader := c.Get("Authorization") - err = _i.aiChatService.DeleteMessage(authHeader, uint(sessionId), uint(messageId)) + err = _i.aiChatService.DeleteMessage(authHeader, uint(messageId)) if err != nil { return err } @@ -391,7 +369,7 @@ func (_i *aiChatController) DeleteMessage(c *fiber.Ctx) error { // @Description API for getting all AI chat logs for authenticated user // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param req query request.AIChatLogsQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -431,7 +409,7 @@ func (_i *aiChatController) GetUserLogs(c *fiber.Ctx) error { // @Description API for getting one AI chat log // @Tags AI Chat // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" +// @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param id path int true "Log ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError diff --git a/app/module/ai_chat/mapper/ai_chat.mapper.go b/app/module/ai_chat/mapper/ai_chat.mapper.go index c136659..957b553 100644 --- a/app/module/ai_chat/mapper/ai_chat.mapper.go +++ b/app/module/ai_chat/mapper/ai_chat.mapper.go @@ -8,12 +8,12 @@ import ( func AIChatSessionsResponseMapper(session *entity.AIChatSessions) *response.AIChatSessionsResponse { result := &response.AIChatSessionsResponse{ ID: session.ID, - AISessionID: session.AISessionID, + SessionID: session.SessionID, UserID: session.UserID, AgentID: session.AgentID, Title: session.Title, MessageCount: session.MessageCount, - Status: session.Status, + IsActive: session.IsActive, CreatedAt: session.CreatedAt, UpdatedAt: session.UpdatedAt, } @@ -36,6 +36,7 @@ func AIChatMessagesResponseMapper(message *entity.AIChatMessages) *response.AICh SessionID: message.SessionID, MessageType: message.MessageType, Content: message.Content, + IsActive: message.IsActive, CreatedAt: message.CreatedAt, } } diff --git a/app/module/ai_chat/repository/ai_chat.repository.go b/app/module/ai_chat/repository/ai_chat.repository.go index ed0d54b..8d1c88b 100644 --- a/app/module/ai_chat/repository/ai_chat.repository.go +++ b/app/module/ai_chat/repository/ai_chat.repository.go @@ -15,18 +15,18 @@ type AIChatRepository interface { // AI Chat Sessions GetUserSessions(userId uint, req request.AIChatSessionsQueryRequest) (sessions []*entity.AIChatSessions, paging paginator.Pagination, err error) FindSessionByUserAndId(userId uint, sessionId uint) (session *entity.AIChatSessions, err error) - FindSessionByAISessionId(aiSessionId string) (session *entity.AIChatSessions, err error) + FindSessionBySessionId(sessionId string) (session *entity.AIChatSessions, err error) CreateSession(session *entity.AIChatSessions) (result *entity.AIChatSessions, err error) UpdateSession(userId uint, sessionId uint, session *entity.AIChatSessions) (err error) DeleteSession(userId uint, sessionId uint) (err error) IncrementMessageCount(sessionId uint) (err error) // AI Chat Messages - GetSessionMessages(sessionId uint, req request.AIChatMessagesQueryRequest) (messages []*entity.AIChatMessages, paging paginator.Pagination, err error) + GetSessionMessages(sessionId string, req request.AIChatMessagesQueryRequest) (messages []*entity.AIChatMessages, paging paginator.Pagination, err error) CreateMessage(message *entity.AIChatMessages) (result *entity.AIChatMessages, err error) UpdateMessage(messageId uint, message *entity.AIChatMessages) (err error) DeleteMessage(messageId uint) (err error) - GetLastMessage(sessionId uint) (message *entity.AIChatMessages, err error) + GetLastMessage(sessionId string) (message *entity.AIChatMessages, err error) // AI Chat Logs GetUserLogs(userId uint, req request.AIChatLogsQueryRequest) (logs []*entity.AIChatLogs, paging paginator.Pagination, err error) @@ -41,15 +41,15 @@ func NewAIChatRepository(db *database.Database) AIChatRepository { // AI Chat Sessions methods func (_i *aiChatRepository) GetUserSessions(userId uint, req request.AIChatSessionsQueryRequest) (sessions []*entity.AIChatSessions, paging paginator.Pagination, err error) { - query := _i.DB.DB.Where("user_id = ?", userId) + query := _i.DB.DB.Model(&entity.AIChatSessions{}).Where("user_id = ?", userId) // Apply filters - if req.Status != nil { - query = query.Where("status = ?", *req.Status) + if req.IsActive != nil { + query = query.Where("is_active = ?", *req.IsActive) } // Include user relationship - query = query.Preload("User") + // query = query.Preload("User") // Order by updated_at desc (most recent first) query = query.Order("updated_at DESC") @@ -67,12 +67,12 @@ func (_i *aiChatRepository) GetUserSessions(userId uint, req request.AIChatSessi } func (_i *aiChatRepository) FindSessionByUserAndId(userId uint, sessionId uint) (session *entity.AIChatSessions, err error) { - err = _i.DB.DB.Where("user_id = ? AND id = ?", userId, sessionId).Preload("User").First(&session).Error + err = _i.DB.DB.Model(&entity.AIChatSessions{}).Where("user_id = ? AND id = ?", userId, sessionId).Preload("User").First(&session).Error return } -func (_i *aiChatRepository) FindSessionByAISessionId(aiSessionId string) (session *entity.AIChatSessions, err error) { - err = _i.DB.DB.Where("ai_session_id = ?", aiSessionId).Preload("User").First(&session).Error +func (_i *aiChatRepository) FindSessionBySessionId(sessionId string) (session *entity.AIChatSessions, err error) { + err = _i.DB.DB.Model(&entity.AIChatSessions{}).Where("session_id = ?", sessionId).Preload("User").First(&session).Error return } @@ -83,17 +83,17 @@ func (_i *aiChatRepository) CreateSession(session *entity.AIChatSessions) (resul } // Reload with relationships - err = _i.DB.DB.Preload("User").First(&result, session.ID).Error + err = _i.DB.DB.Model(&entity.AIChatSessions{}).Preload("User").First(&result, session.ID).Error return } func (_i *aiChatRepository) UpdateSession(userId uint, sessionId uint, session *entity.AIChatSessions) (err error) { - err = _i.DB.DB.Where("user_id = ? AND id = ?", userId, sessionId).Updates(session).Error + err = _i.DB.DB.Model(&entity.AIChatSessions{}).Where("user_id = ? AND id = ?", userId, sessionId).Updates(session).Error return } func (_i *aiChatRepository) DeleteSession(userId uint, sessionId uint) (err error) { - err = _i.DB.DB.Where("user_id = ? AND id = ?", userId, sessionId).Delete(&entity.AIChatSessions{}).Error + err = _i.DB.DB.Model(&entity.AIChatSessions{}).Where("user_id = ? AND id = ?", userId, sessionId).Delete(&entity.AIChatSessions{}).Error return } @@ -103,8 +103,8 @@ func (_i *aiChatRepository) IncrementMessageCount(sessionId uint) (err error) { } // AI Chat Messages methods -func (_i *aiChatRepository) GetSessionMessages(sessionId uint, req request.AIChatMessagesQueryRequest) (messages []*entity.AIChatMessages, paging paginator.Pagination, err error) { - query := _i.DB.DB.Where("session_id = ?", sessionId) +func (_i *aiChatRepository) GetSessionMessages(sessionId string, req request.AIChatMessagesQueryRequest) (messages []*entity.AIChatMessages, paging paginator.Pagination, err error) { + query := _i.DB.DB.Model(&entity.AIChatMessages{}).Where("session_id = ?", sessionId) // Order by created_at asc (oldest first for chat) query = query.Order("created_at ASC") @@ -128,7 +128,7 @@ func (_i *aiChatRepository) CreateMessage(message *entity.AIChatMessages) (resul } // Reload - err = _i.DB.DB.First(&result, message.ID).Error + err = _i.DB.DB.Model(&entity.AIChatMessages{}).First(&result, message.ID).Error return } @@ -138,7 +138,7 @@ func (_i *aiChatRepository) UpdateMessage(messageId uint, message *entity.AIChat } func (_i *aiChatRepository) DeleteMessage(messageId uint) (err error) { - err = _i.DB.DB.Where("id = ?", messageId).Delete(&entity.AIChatMessages{}).Error + err = _i.DB.DB.Model(&entity.AIChatMessages{}).Where("id = ?", messageId).Delete(&entity.AIChatMessages{}).Error return } @@ -146,7 +146,7 @@ func (_i *aiChatRepository) DeleteMessage(messageId uint) (err error) { func (_i *aiChatRepository) GetUserLogs(userId uint, req request.AIChatLogsQueryRequest) (logs []*entity.AIChatLogs, paging paginator.Pagination, err error) { var count int64 - query := _i.DB.DB.Where("user_id = ?", userId) + query := _i.DB.DB.Model(&entity.AIChatLogs{}).Where("user_id = ?", userId) // Note: AIChatLogs entity doesn't have LogType field, so we skip this filter // if req.LogType != nil && *req.LogType != "" { @@ -154,7 +154,7 @@ func (_i *aiChatRepository) GetUserLogs(userId uint, req request.AIChatLogsQuery // } // Count total records - err = query.Model(&entity.AIChatLogs{}).Count(&count).Error + err = query.Count(&count).Error if err != nil { return } @@ -183,7 +183,7 @@ func (_i *aiChatRepository) GetUserLogs(userId uint, req request.AIChatLogsQuery } func (_i *aiChatRepository) FindLogByUserAndId(userId uint, logId uint) (log *entity.AIChatLogs, err error) { - query := _i.DB.DB.Where("user_id = ? AND id = ?", userId, logId) + query := _i.DB.DB.Model(&entity.AIChatLogs{}).Where("user_id = ? AND id = ?", userId, logId) if err := query.First(&log).Error; err != nil { return nil, err @@ -192,7 +192,7 @@ func (_i *aiChatRepository) FindLogByUserAndId(userId uint, logId uint) (log *en return } -func (_i *aiChatRepository) GetLastMessage(sessionId uint) (message *entity.AIChatMessages, err error) { - err = _i.DB.DB.Where("session_id = ?", sessionId).Order("created_at DESC").First(&message).Error +func (_i *aiChatRepository) GetLastMessage(sessionId string) (message *entity.AIChatMessages, err error) { + err = _i.DB.DB.Model(&entity.AIChatMessages{}).Where("session_id = ?", sessionId).Order("created_at DESC").First(&message).Error return } diff --git a/app/module/ai_chat/request/ai_chat.request.go b/app/module/ai_chat/request/ai_chat.request.go index 83e3151..e28d97c 100644 --- a/app/module/ai_chat/request/ai_chat.request.go +++ b/app/module/ai_chat/request/ai_chat.request.go @@ -7,45 +7,46 @@ import ( // AI Chat Sessions Request DTOs type AIChatSessionsQueryRequest struct { - Status *string `json:"status"` + IsActive *bool `json:"isActive"` Pagination *paginator.Pagination `json:"pagination"` } type AIChatSessionsCreateRequest struct { - Title string `json:"title" validate:"required,min=2,max=255"` - AgentID *string `json:"agentId"` + SessionID string `json:"sessionId" validate:"required"` + Title string `json:"title" validate:"required,min=2,max=255"` + AgentID string `json:"agentId" validate:"required"` } func (req AIChatSessionsCreateRequest) ToEntity() *entity.AIChatSessions { return &entity.AIChatSessions{ - AISessionID: "", // Will be generated in service layer + SessionID: req.SessionID, AgentID: req.AgentID, Title: req.Title, MessageCount: 0, - Status: "active", + IsActive: true, } } type AIChatSessionsUpdateRequest struct { - Title string `json:"title" validate:"required,min=2,max=255"` - Status string `json:"status" validate:"required,oneof=active archived deleted"` + Title string `json:"title" validate:"required,min=2,max=255"` + IsActive bool `json:"isActive"` } func (req AIChatSessionsUpdateRequest) ToEntity() *entity.AIChatSessions { return &entity.AIChatSessions{ - Title: req.Title, - Status: req.Status, + Title: req.Title, + IsActive: req.IsActive, } } // AI Chat Messages Request DTOs type AIChatMessagesQueryRequest struct { - SessionID uint `json:"sessionId" validate:"required"` + SessionID string `json:"sessionId" validate:"required"` Pagination *paginator.Pagination `json:"pagination"` } type AIChatMessagesCreateRequest struct { - SessionID uint `json:"sessionId" validate:"required"` + SessionID string `json:"sessionId" validate:"required"` MessageType string `json:"messageType" validate:"required,oneof=user assistant"` Content string `json:"content" validate:"required,min=1"` } @@ -55,6 +56,7 @@ func (req AIChatMessagesCreateRequest) ToEntity() *entity.AIChatMessages { SessionID: req.SessionID, MessageType: req.MessageType, Content: req.Content, + IsActive: true, } } @@ -69,14 +71,15 @@ func (req AIChatMessagesUpdateRequest) ToEntity() *entity.AIChatMessages { } type AIChatSessionsQueryRequestContext struct { - Status string `json:"status"` + IsActive string `json:"isActive"` } func (req AIChatSessionsQueryRequestContext) ToParamRequest() AIChatSessionsQueryRequest { var request AIChatSessionsQueryRequest - if status := req.Status; status != "" { - request.Status = &status + if isActiveStr := req.IsActive; isActiveStr != "" { + isActive := isActiveStr == "true" + request.IsActive = &isActive } return request diff --git a/app/module/ai_chat/response/ai_chat.response.go b/app/module/ai_chat/response/ai_chat.response.go index 7abf617..6dbfd30 100644 --- a/app/module/ai_chat/response/ai_chat.response.go +++ b/app/module/ai_chat/response/ai_chat.response.go @@ -7,12 +7,12 @@ import ( // AI Chat Sessions Response DTOs type AIChatSessionsResponse struct { ID uint `json:"id"` - AISessionID string `json:"aiSessionId"` + SessionID string `json:"sessionId"` UserID uint `json:"userId"` - AgentID *string `json:"agentId"` + AgentID string `json:"agentId"` Title string `json:"title"` MessageCount int `json:"messageCount"` - Status string `json:"status"` + IsActive bool `json:"isActive"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` @@ -26,9 +26,10 @@ type AIChatSessionsResponse struct { // AI Chat Messages Response DTOs type AIChatMessagesResponse struct { ID uint `json:"id"` - SessionID uint `json:"sessionId"` + SessionID string `json:"sessionId"` MessageType string `json:"messageType"` Content string `json:"content"` + IsActive bool `json:"isActive"` CreatedAt time.Time `json:"createdAt"` } diff --git a/app/module/ai_chat/service/ai_chat.service.go b/app/module/ai_chat/service/ai_chat.service.go index d03eb86..c6d236f 100644 --- a/app/module/ai_chat/service/ai_chat.service.go +++ b/app/module/ai_chat/service/ai_chat.service.go @@ -2,7 +2,6 @@ package service import ( "errors" - "fmt" "narasi-ahli-be/app/module/ai_chat/mapper" "narasi-ahli-be/app/module/ai_chat/repository" "narasi-ahli-be/app/module/ai_chat/request" @@ -23,17 +22,17 @@ type aiChatService struct { type AIChatService interface { // Sessions GetUserSessions(authToken string, req request.AIChatSessionsQueryRequest) (sessions []*response.AIChatSessionsResponse, paging paginator.Pagination, err error) - GetSession(authToken string, sessionId uint) (session *response.AIChatSessionsResponse, err error) + GetSession(authToken string, id uint) (session *response.AIChatSessionsResponse, err error) CreateSession(authToken string, req request.AIChatSessionsCreateRequest) (session *response.AIChatSessionsResponse, err error) - UpdateSession(authToken string, sessionId uint, req request.AIChatSessionsUpdateRequest) (err error) - DeleteSession(authToken string, sessionId uint) error - ArchiveSession(authToken string, sessionId uint) error + UpdateSession(authToken string, id uint, req request.AIChatSessionsUpdateRequest) (err error) + DeleteSession(authToken string, id uint) error + ArchiveSession(authToken string, id uint) error // Messages - GetSessionMessages(authToken string, sessionId uint, req request.AIChatMessagesQueryRequest) (messages []*response.AIChatMessagesResponse, paging paginator.Pagination, err error) - SendMessage(authToken string, sessionId uint, req request.AIChatMessagesCreateRequest) (message *response.AIChatMessagesResponse, err error) - UpdateMessage(authToken string, sessionId uint, messageId uint, req request.AIChatMessagesUpdateRequest) (err error) - DeleteMessage(authToken string, sessionId uint, messageId uint) error + GetSessionMessages(authToken string, sessionId string, req request.AIChatMessagesQueryRequest) (messages []*response.AIChatMessagesResponse, paging paginator.Pagination, err error) + SendMessage(authToken string, req request.AIChatMessagesCreateRequest) (message *response.AIChatMessagesResponse, err error) + UpdateMessage(authToken string, messageId uint, req request.AIChatMessagesUpdateRequest) (err error) + DeleteMessage(authToken string, messageId uint) error // Logs GetUserLogs(authToken string, req request.AIChatLogsQueryRequest) (logs []*response.AIChatLogsResponse, paging paginator.Pagination, err error) @@ -64,10 +63,10 @@ func (_i *aiChatService) GetUserSessions(authToken string, req request.AIChatSes return } -func (_i *aiChatService) GetSession(authToken string, sessionId uint) (session *response.AIChatSessionsResponse, err error) { +func (_i *aiChatService) GetSession(authToken string, id uint) (session *response.AIChatSessionsResponse, err error) { userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - result, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) + result, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, id) if err != nil { return nil, err } @@ -81,8 +80,7 @@ func (_i *aiChatService) CreateSession(authToken string, req request.AIChatSessi entity := req.ToEntity() entity.UserID = userInfo.ID - // Generate unique AI session ID - entity.AISessionID = fmt.Sprintf("ai_session_%d_%d", userInfo.ID, entity.ID) + _i.Log.Info().Interface("data", entity).Msg("Create AI chat session") result, err := _i.Repo.CreateSession(entity) if err != nil { @@ -92,12 +90,12 @@ func (_i *aiChatService) CreateSession(authToken string, req request.AIChatSessi return mapper.AIChatSessionsResponseMapper(result), nil } -func (_i *aiChatService) UpdateSession(authToken string, sessionId uint, req request.AIChatSessionsUpdateRequest) (err error) { +func (_i *aiChatService) UpdateSession(authToken string, id uint, req request.AIChatSessionsUpdateRequest) (err error) { userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) _i.Log.Info().Interface("data", req).Msg("Updating AI chat session") // Check if session exists and belongs to user - existing, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) + existing, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, id) if err != nil { return err } @@ -106,15 +104,14 @@ func (_i *aiChatService) UpdateSession(authToken string, sessionId uint, req req } entity := req.ToEntity() - return _i.Repo.UpdateSession(userInfo.ID, sessionId, entity) + return _i.Repo.UpdateSession(userInfo.ID, id, entity) } -func (_i *aiChatService) DeleteSession(authToken string, sessionId uint) error { +func (_i *aiChatService) DeleteSession(authToken string, id uint) error { userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Uint("userId", userInfo.ID).Uint("sessionId", sessionId).Msg("Deleting AI chat session") // Check if session exists and belongs to user - existing, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) + existing, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, id) if err != nil { return err } @@ -122,15 +119,14 @@ func (_i *aiChatService) DeleteSession(authToken string, sessionId uint) error { return errors.New("AI chat session not found") } - return _i.Repo.DeleteSession(userInfo.ID, sessionId) + return _i.Repo.DeleteSession(userInfo.ID, id) } -func (_i *aiChatService) ArchiveSession(authToken string, sessionId uint) error { +func (_i *aiChatService) ArchiveSession(authToken string, id uint) error { userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Uint("userId", userInfo.ID).Uint("sessionId", sessionId).Msg("Archiving AI chat session") // Check if session exists and belongs to user - existing, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) + existing, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, id) if err != nil { return err } @@ -139,16 +135,16 @@ func (_i *aiChatService) ArchiveSession(authToken string, sessionId uint) error } // Update status to archived - existing.Status = "archived" - return _i.Repo.UpdateSession(userInfo.ID, sessionId, existing) + existing.IsActive = false + return _i.Repo.UpdateSession(userInfo.ID, id, existing) } // Messages methods -func (_i *aiChatService) GetSessionMessages(authToken string, sessionId uint, req request.AIChatMessagesQueryRequest) (messages []*response.AIChatMessagesResponse, paging paginator.Pagination, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) +func (_i *aiChatService) GetSessionMessages(authToken string, sessionId string, req request.AIChatMessagesQueryRequest) (messages []*response.AIChatMessagesResponse, paging paginator.Pagination, err error) { + // userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) + _, err = _i.Repo.FindSessionBySessionId(sessionId) if err != nil { return nil, paginator.Pagination{}, err } @@ -165,12 +161,11 @@ func (_i *aiChatService) GetSessionMessages(authToken string, sessionId uint, re return } -func (_i *aiChatService) SendMessage(authToken string, sessionId uint, req request.AIChatMessagesCreateRequest) (message *response.AIChatMessagesResponse, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Interface("data", req).Msg("Sending AI chat message") +func (_i *aiChatService) SendMessage(authToken string, req request.AIChatMessagesCreateRequest) (message *response.AIChatMessagesResponse, err error) { + // userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndId(userInfo.ID, req.SessionID) + // Verify session exists + session, err := _i.Repo.FindSessionBySessionId(req.SessionID) if err != nil { return nil, err } @@ -183,7 +178,7 @@ func (_i *aiChatService) SendMessage(authToken string, sessionId uint, req reque } // Increment message count in session - err = _i.Repo.IncrementMessageCount(req.SessionID) + err = _i.Repo.IncrementMessageCount(session.ID) if err != nil { _i.Log.Error().Err(err).Msg("Failed to increment message count") } @@ -192,28 +187,16 @@ func (_i *aiChatService) SendMessage(authToken string, sessionId uint, req reque } // Update Message -func (_i *aiChatService) UpdateMessage(authToken string, sessionId uint, messageId uint, req request.AIChatMessagesUpdateRequest) (err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) - if err != nil { - return err - } +func (_i *aiChatService) UpdateMessage(authToken string, messageId uint, req request.AIChatMessagesUpdateRequest) (err error) { + // userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) entity := req.ToEntity() return _i.Repo.UpdateMessage(messageId, entity) } // Delete Message -func (_i *aiChatService) DeleteMessage(authToken string, sessionId uint, messageId uint) error { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Verify session belongs to user - _, err := _i.Repo.FindSessionByUserAndId(userInfo.ID, sessionId) - if err != nil { - return err - } +func (_i *aiChatService) DeleteMessage(authToken string, messageId uint) error { + // userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) return _i.Repo.DeleteMessage(messageId) } diff --git a/app/module/article_approvals/controller/article_approvals.controller.go b/app/module/article_approvals/controller/article_approvals.controller.go index 8a67a0a..987fe51 100644 --- a/app/module/article_approvals/controller/article_approvals.controller.go +++ b/app/module/article_approvals/controller/article_approvals.controller.go @@ -1,7 +1,7 @@ package controller import ( - "narasi-ahli-be/app/module/article_approvals/request" + "narasi-ahli-be/app/module/article_approvals/request" "narasi-ahli-be/app/module/article_approvals/service" "narasi-ahli-be/utils/paginator" "strconv" @@ -108,7 +108,6 @@ func (_i *articleApprovalsController) Show(c *fiber.Ctx) error { // @Description API for create ArticleApprovals // @Tags ArticleApprovals // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.ArticleApprovalsCreateRequest true "Required payload" @@ -126,7 +125,7 @@ func (_i *articleApprovalsController) Save(c *fiber.Ctx) error { authToken := c.Get("Authorization") // Get from context - dataResult, err := _i.articleApprovalsService.Save(*req, authToken) + dataResult, err := _i.articleApprovalsService.Save(*req, authToken) if err != nil { return err } diff --git a/app/module/article_categories/controller/article_categories.controller.go b/app/module/article_categories/controller/article_categories.controller.go index f0ebc9a..23e0728 100644 --- a/app/module/article_categories/controller/article_categories.controller.go +++ b/app/module/article_categories/controller/article_categories.controller.go @@ -1,7 +1,7 @@ package controller import ( - "narasi-ahli-be/app/module/article_categories/request" + "narasi-ahli-be/app/module/article_categories/request" "narasi-ahli-be/app/module/article_categories/service" "narasi-ahli-be/utils/paginator" "strconv" @@ -39,7 +39,6 @@ func NewArticleCategoriesController(articleCategoriesService service.ArticleCate // @Description API for getting all ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param req query request.ArticleCategoriesQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" @@ -55,7 +54,7 @@ func (_i *articleCategoriesController) All(c *fiber.Ctx) error { } authToken := c.Get("Authorization") - reqContext := request.ArticleCategoriesQueryRequestContext{ + reqContext := request.ArticleCategoriesQueryRequestContext{ Title: c.Query("title"), Description: c.Query("description"), ParentId: c.Query("parentId"), @@ -83,7 +82,6 @@ func (_i *articleCategoriesController) All(c *fiber.Ctx) error { // @Description API for getting one ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "ArticleCategories ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -96,7 +94,7 @@ func (_i *articleCategoriesController) Show(c *fiber.Ctx) error { return err } - articleCategoriesData, err := _i.articleCategoriesService.Show(uint(id)) + articleCategoriesData, err := _i.articleCategoriesService.Show(uint(id)) if err != nil { return err } @@ -113,7 +111,6 @@ func (_i *articleCategoriesController) Show(c *fiber.Ctx) error { // @Description API for getting one ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "ArticleCategories Old ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -126,7 +123,7 @@ func (_i *articleCategoriesController) ShowByOldId(c *fiber.Ctx) error { return err } - articleCategoriesData, err := _i.articleCategoriesService.ShowByOldId(uint(id)) + articleCategoriesData, err := _i.articleCategoriesService.ShowByOldId(uint(id)) if err != nil { return err } @@ -143,7 +140,6 @@ func (_i *articleCategoriesController) ShowByOldId(c *fiber.Ctx) error { // @Description API for getting one ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param slug path string true "ArticleCategories Slug" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -152,7 +148,7 @@ func (_i *articleCategoriesController) ShowByOldId(c *fiber.Ctx) error { // @Router /article-categories/slug/{slug} [get] func (_i *articleCategoriesController) ShowBySlug(c *fiber.Ctx) error { slug := c.Params("slug") - articleCategoriesData, err := _i.articleCategoriesService.ShowBySlug(slug) + articleCategoriesData, err := _i.articleCategoriesService.ShowBySlug(slug) if err != nil { return err } @@ -169,7 +165,6 @@ func (_i *articleCategoriesController) ShowBySlug(c *fiber.Ctx) error { // @Description API for create ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.ArticleCategoriesCreateRequest true "Required payload" @@ -185,7 +180,7 @@ func (_i *articleCategoriesController) Save(c *fiber.Ctx) error { } authToken := c.Get("Authorization") - dataResult, err := _i.articleCategoriesService.Save(*req, authToken) + dataResult, err := _i.articleCategoriesService.Save(*req, authToken) if err != nil { return err } @@ -203,7 +198,6 @@ func (_i *articleCategoriesController) Save(c *fiber.Ctx) error { // @Tags Article Categories // @Security Bearer // @Produce json -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param files formData file true "Upload thumbnail" // @Param id path int true "ArticleCategories ID" @@ -213,7 +207,7 @@ func (_i *articleCategoriesController) Save(c *fiber.Ctx) error { // @Failure 500 {object} response.InternalServerError // @Router /article-categories/thumbnail/{id} [post] func (_i *articleCategoriesController) SaveThumbnail(c *fiber.Ctx) error { - err := _i.articleCategoriesService.SaveThumbnail(c) + err := _i.articleCategoriesService.SaveThumbnail(c) if err != nil { return err } @@ -229,7 +223,6 @@ func (_i *articleCategoriesController) SaveThumbnail(c *fiber.Ctx) error { // @Description API for update ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.ArticleCategoriesUpdateRequest true "Required payload" // @Param id path int true "ArticleCategories ID" @@ -249,7 +242,7 @@ func (_i *articleCategoriesController) Update(c *fiber.Ctx) error { return err } - err = _i.articleCategoriesService.Update(uint(id), *req) + err = _i.articleCategoriesService.Update(uint(id), *req) if err != nil { return err } @@ -265,7 +258,6 @@ func (_i *articleCategoriesController) Update(c *fiber.Ctx) error { // @Description API for delete ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "ArticleCategories ID" // @Success 200 {object} response.Response @@ -279,7 +271,7 @@ func (_i *articleCategoriesController) Delete(c *fiber.Ctx) error { return err } - err = _i.articleCategoriesService.Delete(uint(id)) + err = _i.articleCategoriesService.Delete(uint(id)) if err != nil { return err } @@ -295,7 +287,6 @@ func (_i *articleCategoriesController) Delete(c *fiber.Ctx) error { // @Description API for View Thumbnail of ArticleCategories // @Tags Article Categories // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path string true "ArticleCategories ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError diff --git a/app/module/article_comments/controller/article_comments.controller.go b/app/module/article_comments/controller/article_comments.controller.go index 518f63a..da019b8 100644 --- a/app/module/article_comments/controller/article_comments.controller.go +++ b/app/module/article_comments/controller/article_comments.controller.go @@ -1,14 +1,15 @@ package controller import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "narasi-ahli-be/app/module/article_comments/request" + "narasi-ahli-be/app/module/article_comments/request" "narasi-ahli-be/app/module/article_comments/service" "narasi-ahli-be/utils/paginator" utilRes "narasi-ahli-be/utils/response" utilVal "narasi-ahli-be/utils/validator" "strconv" + + "github.com/gofiber/fiber/v2" + "github.com/rs/zerolog" ) type articleCommentsController struct { @@ -37,7 +38,6 @@ func NewArticleCommentsController(articleCommentsService service.ArticleComments // @Description API for getting all ArticleComments // @Tags ArticleComments // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.ArticleCommentsQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -47,7 +47,7 @@ func NewArticleCommentsController(articleCommentsService service.ArticleComments // @Router /article-comments [get] func (_i *articleCommentsController) All(c *fiber.Ctx) error { // Get from context - paginate, err := paginator.Paginate(c) + paginate, err := paginator.Paginate(c) if err != nil { return err } @@ -80,7 +80,6 @@ func (_i *articleCommentsController) All(c *fiber.Ctx) error { // @Description API for getting one ArticleComments // @Tags ArticleComments // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "ArticleComments ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -89,7 +88,7 @@ func (_i *articleCommentsController) All(c *fiber.Ctx) error { // @Router /article-comments/{id} [get] func (_i *articleCommentsController) Show(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("id"), 10, 0) + id, err := strconv.ParseUint(c.Params("id"), 10, 0) if err != nil { return err } @@ -111,7 +110,6 @@ func (_i *articleCommentsController) Show(c *fiber.Ctx) error { // @Description API for create ArticleComments // @Tags ArticleComments // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.ArticleCommentsCreateRequest true "Required payload" @@ -122,7 +120,7 @@ func (_i *articleCommentsController) Show(c *fiber.Ctx) error { // @Router /article-comments [post] func (_i *articleCommentsController) Save(c *fiber.Ctx) error { // Get from context - req := new(request.ArticleCommentsCreateRequest) + req := new(request.ArticleCommentsCreateRequest) if err := utilVal.ParseAndValidate(c, req); err != nil { return err } @@ -145,7 +143,6 @@ func (_i *articleCommentsController) Save(c *fiber.Ctx) error { // @Description API for update ArticleComments // @Tags ArticleComments // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.ArticleCommentsUpdateRequest true "Required payload" // @Param id path int true "ArticleComments ID" @@ -156,7 +153,7 @@ func (_i *articleCommentsController) Save(c *fiber.Ctx) error { // @Router /article-comments/{id} [put] func (_i *articleCommentsController) Update(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("id"), 10, 0) + id, err := strconv.ParseUint(c.Params("id"), 10, 0) if err != nil { return err } @@ -182,7 +179,6 @@ func (_i *articleCommentsController) Update(c *fiber.Ctx) error { // @Description API for delete ArticleComments // @Tags ArticleComments // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "ArticleComments ID" // @Success 200 {object} response.Response @@ -192,7 +188,7 @@ func (_i *articleCommentsController) Update(c *fiber.Ctx) error { // @Router /article-comments/{id} [delete] func (_i *articleCommentsController) Delete(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("id"), 10, 0) + id, err := strconv.ParseUint(c.Params("id"), 10, 0) if err != nil { return err } @@ -213,7 +209,6 @@ func (_i *articleCommentsController) Delete(c *fiber.Ctx) error { // @Description API for Approval ArticleComments // @Tags ArticleComments // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.ArticleCommentsApprovalRequest true "Required payload" // @Success 200 {object} response.Response @@ -223,7 +218,7 @@ func (_i *articleCommentsController) Delete(c *fiber.Ctx) error { // @Router /article-comments/approval [post] func (_i *articleCommentsController) Approval(c *fiber.Ctx) error { // Get from context - req := new(request.ArticleCommentsApprovalRequest) + req := new(request.ArticleCommentsApprovalRequest) if err := utilVal.ParseAndValidate(c, req); err != nil { return err } diff --git a/app/module/article_files/controller/article_files.controller.go b/app/module/article_files/controller/article_files.controller.go index ed9c071..aff1c44 100644 --- a/app/module/article_files/controller/article_files.controller.go +++ b/app/module/article_files/controller/article_files.controller.go @@ -2,7 +2,7 @@ package controller import ( "fmt" - "narasi-ahli-be/app/module/article_files/request" + "narasi-ahli-be/app/module/article_files/request" "narasi-ahli-be/app/module/article_files/service" "narasi-ahli-be/utils/paginator" utilRes "narasi-ahli-be/utils/response" @@ -37,7 +37,6 @@ func NewArticleFilesController(articleFilesService service.ArticleFilesService) // @Description API for getting all ArticleFiles // @Tags Article Files // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.ArticleFilesQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -47,7 +46,7 @@ func NewArticleFilesController(articleFilesService service.ArticleFilesService) // @Router /article-files [get] func (_i *articleFilesController) All(c *fiber.Ctx) error { // Get from context - paginate, err := paginator.Paginate(c) + paginate, err := paginator.Paginate(c) if err != nil { return err } @@ -79,7 +78,6 @@ func (_i *articleFilesController) All(c *fiber.Ctx) error { // @Description API for getting one ArticleFiles // @Tags Article Files // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "ArticleFiles ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -88,7 +86,7 @@ func (_i *articleFilesController) All(c *fiber.Ctx) error { // @Router /article-files/{id} [get] func (_i *articleFilesController) Show(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("id"), 10, 0) + id, err := strconv.ParseUint(c.Params("id"), 10, 0) if err != nil { return err } @@ -111,7 +109,6 @@ func (_i *articleFilesController) Show(c *fiber.Ctx) error { // @Tags Article Files // @Security Bearer // @Produce json -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param files formData file true "Upload file" multiple true // @Param articleId path int true "Article ID" @@ -122,7 +119,7 @@ func (_i *articleFilesController) Show(c *fiber.Ctx) error { // @Router /article-files/{articleId} [post] func (_i *articleFilesController) Save(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("articleId"), 10, 0) + id, err := strconv.ParseUint(c.Params("articleId"), 10, 0) if err != nil { return err } @@ -143,7 +140,6 @@ func (_i *articleFilesController) Save(c *fiber.Ctx) error { // @Description API for update ArticleFiles // @Tags Article Files // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.ArticleFilesUpdateRequest true "Required payload" // @Param id path int true "ArticleFiles ID" @@ -154,7 +150,7 @@ func (_i *articleFilesController) Save(c *fiber.Ctx) error { // @Router /article-files/{id} [put] func (_i *articleFilesController) Update(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("id"), 10, 0) + id, err := strconv.ParseUint(c.Params("id"), 10, 0) if err != nil { return err } @@ -180,7 +176,6 @@ func (_i *articleFilesController) Update(c *fiber.Ctx) error { // @Description API for delete ArticleFiles // @Tags Article Files // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "ArticleFiles ID" // @Success 200 {object} response.Response @@ -190,7 +185,7 @@ func (_i *articleFilesController) Update(c *fiber.Ctx) error { // @Router /article-files/{id} [delete] func (_i *articleFilesController) Delete(c *fiber.Ctx) error { // Get from context - id, err := strconv.ParseUint(c.Params("id"), 10, 0) + id, err := strconv.ParseUint(c.Params("id"), 10, 0) if err != nil { return err } @@ -211,7 +206,6 @@ func (_i *articleFilesController) Delete(c *fiber.Ctx) error { // @Description API for Viewer ArticleFiles // @Tags Article Files // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param filename path string true "Article File Name" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -220,7 +214,7 @@ func (_i *articleFilesController) Delete(c *fiber.Ctx) error { // @Router /article-files/viewer/{filename} [get] func (_i *articleFilesController) Viewer(c *fiber.Ctx) error { // Get from context - return _i.articleFilesService.Viewer(c) + return _i.articleFilesService.Viewer(c) } // GetUploadStatus ArticleFiles diff --git a/app/module/articles/controller/articles.controller.go b/app/module/articles/controller/articles.controller.go index 5b61ba5..667baae 100644 --- a/app/module/articles/controller/articles.controller.go +++ b/app/module/articles/controller/articles.controller.go @@ -106,7 +106,7 @@ func (_i *articlesController) Show(c *fiber.Ctx) error { } // Get from context - articlesData, err := _i.articlesService.Show(uint(id)) + articlesData, err := _i.articlesService.Show(uint(id)) if err != nil { return err } @@ -136,7 +136,7 @@ func (_i *articlesController) ShowByOldId(c *fiber.Ctx) error { } // Get from context - articlesData, err := _i.articlesService.ShowByOldId(uint(id)) + articlesData, err := _i.articlesService.ShowByOldId(uint(id)) if err != nil { return err } @@ -153,7 +153,6 @@ func (_i *articlesController) ShowByOldId(c *fiber.Ctx) error { // @Description API for create Articles // @Tags Articles // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string false "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.ArticlesCreateRequest true "Required payload" @@ -171,7 +170,7 @@ func (_i *articlesController) Save(c *fiber.Ctx) error { authToken := c.Get("Authorization") // Get from context - dataResult, err := _i.articlesService.Save(*req, authToken) + dataResult, err := _i.articlesService.Save(*req, authToken) if err != nil { return err } @@ -189,7 +188,6 @@ func (_i *articlesController) Save(c *fiber.Ctx) error { // @Tags Articles // @Security Bearer // @Produce json -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param files formData file true "Upload thumbnail" // @Param id path int true "Articles ID" @@ -200,7 +198,7 @@ func (_i *articlesController) Save(c *fiber.Ctx) error { // @Router /articles/thumbnail/{id} [post] func (_i *articlesController) SaveThumbnail(c *fiber.Ctx) error { // Get from context - err := _i.articlesService.SaveThumbnail(c) + err := _i.articlesService.SaveThumbnail(c) if err != nil { return err } @@ -236,7 +234,7 @@ func (_i *articlesController) Update(c *fiber.Ctx) error { } // Get from context - err = _i.articlesService.Update(uint(id), *req) + err = _i.articlesService.Update(uint(id), *req) if err != nil { return err } @@ -272,7 +270,7 @@ func (_i *articlesController) UpdateBanner(c *fiber.Ctx) error { } // Get from context - err = _i.articlesService.UpdateBanner(uint(id), isBanner) + err = _i.articlesService.UpdateBanner(uint(id), isBanner) if err != nil { return err } @@ -302,7 +300,7 @@ func (_i *articlesController) Delete(c *fiber.Ctx) error { } // Get from context - err = _i.articlesService.Delete(uint(id)) + err = _i.articlesService.Delete(uint(id)) if err != nil { return err } @@ -326,7 +324,7 @@ func (_i *articlesController) Delete(c *fiber.Ctx) error { // @Router /articles/thumbnail/viewer/{thumbnailName} [get] func (_i *articlesController) Viewer(c *fiber.Ctx) error { // Get from context - return _i.articlesService.Viewer(c) + return _i.articlesService.Viewer(c) } // SummaryStats Articles @@ -344,7 +342,7 @@ func (_i *articlesController) SummaryStats(c *fiber.Ctx) error { authToken := c.Get("Authorization") // Get from context - response, err := _i.articlesService.SummaryStats(authToken) + response, err := _i.articlesService.SummaryStats(authToken) if err != nil { return err } @@ -375,7 +373,7 @@ func (_i *articlesController) ArticlePerUserLevelStats(c *fiber.Ctx) error { endDate := c.Query("endDate") // Get from context - response, err := _i.articlesService.ArticlePerUserLevelStats(authToken, &startDate, &endDate) + response, err := _i.articlesService.ArticlePerUserLevelStats(authToken, &startDate, &endDate) if err != nil { return err } @@ -408,7 +406,7 @@ func (_i *articlesController) ArticleMonthlyStats(c *fiber.Ctx) error { } // Get from context - response, err := _i.articlesService.ArticleMonthlyStats(authToken, &yearInt) + response, err := _i.articlesService.ArticleMonthlyStats(authToken, &yearInt) if err != nil { return err } @@ -442,7 +440,7 @@ func (_i *articlesController) PublishScheduling(c *fiber.Ctx) error { date := c.Query("date") // Get from context - err = _i.articlesService.PublishScheduling(uint(id), date) + err = _i.articlesService.PublishScheduling(uint(id), date) if err != nil { return err } diff --git a/app/module/chat_history/chat_history.module.go b/app/module/chat_history/chat_history.module.go deleted file mode 100644 index a6cd25d..0000000 --- a/app/module/chat_history/chat_history.module.go +++ /dev/null @@ -1,64 +0,0 @@ -package chat_history - -import ( - "narasi-ahli-be/app/module/chat_history/controller" - "narasi-ahli-be/app/module/chat_history/repository" - "narasi-ahli-be/app/module/chat_history/service" - - "github.com/gofiber/fiber/v2" - "go.uber.org/fx" -) - -// struct of ChatHistoryRouter -type ChatHistoryRouter struct { - App fiber.Router - Controller controller.ChatHistoryController -} - -// register bulky of Chat History module -var NewChatHistoryModule = fx.Options( - // register repository of Chat History module - fx.Provide(repository.NewChatHistoryRepository), - - // register service of Chat History module - fx.Provide(service.NewChatHistoryService), - - // register controller of Chat History module - fx.Provide(controller.NewChatHistoryController), - - // register router of Chat History module - fx.Provide(NewChatHistoryRouter), -) - -// init ChatHistoryRouter -func NewChatHistoryRouter(fiber *fiber.App, controller controller.ChatHistoryController) *ChatHistoryRouter { - return &ChatHistoryRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of Chat History module -func (_i *ChatHistoryRouter) RegisterChatHistoryRoutes() { - // define controllers - chatHistoryController := _i.Controller - - // define routes - _i.App.Route("/chat-history", func(router fiber.Router) { - // Sessions routes - router.Get("/sessions", chatHistoryController.GetUserSessions) - router.Get("/sessions/:sessionId", chatHistoryController.GetSession) - router.Post("/sessions", chatHistoryController.CreateSession) - router.Put("/sessions/:sessionId", chatHistoryController.UpdateSession) - router.Delete("/sessions/:sessionId", chatHistoryController.DeleteSession) - - // Messages routes - router.Get("/sessions/:sessionId/messages", chatHistoryController.GetSessionMessages) - router.Post("/sessions/:sessionId/messages", chatHistoryController.CreateMessage) - router.Put("/messages/:messageId", chatHistoryController.UpdateMessage) - router.Delete("/messages/:messageId", chatHistoryController.DeleteMessage) - - // Combined operations - router.Post("/save", chatHistoryController.SaveChatHistory) - }) -} diff --git a/app/module/chat_history/controller/chat_history.controller.go b/app/module/chat_history/controller/chat_history.controller.go deleted file mode 100644 index 1c0f7c5..0000000 --- a/app/module/chat_history/controller/chat_history.controller.go +++ /dev/null @@ -1,424 +0,0 @@ -package controller - -import ( - "narasi-ahli-be/app/module/chat_history/request" - "narasi-ahli-be/app/module/chat_history/service" - "narasi-ahli-be/utils/paginator" - utilRes "narasi-ahli-be/utils/response" - utilVal "narasi-ahli-be/utils/validator" - "strconv" - - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" -) - -type chatHistoryController struct { - chatHistoryService service.ChatHistoryService - Log zerolog.Logger -} - -type ChatHistoryController interface { - // Chat History Sessions - GetUserSessions(c *fiber.Ctx) error - GetSession(c *fiber.Ctx) error - CreateSession(c *fiber.Ctx) error - UpdateSession(c *fiber.Ctx) error - DeleteSession(c *fiber.Ctx) error - - // Chat History Messages - GetSessionMessages(c *fiber.Ctx) error - CreateMessage(c *fiber.Ctx) error - UpdateMessage(c *fiber.Ctx) error - DeleteMessage(c *fiber.Ctx) error - - // Combined operations - SaveChatHistory(c *fiber.Ctx) error -} - -func NewChatHistoryController(chatHistoryService service.ChatHistoryService, log zerolog.Logger) ChatHistoryController { - return &chatHistoryController{ - chatHistoryService: chatHistoryService, - Log: log, - } -} - -// Get User Sessions -// @Summary Get user chat history sessions -// @Description API for getting all chat history sessions for authenticated user -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param req query request.ChatHistorySessionsQueryRequest false "query parameters" -// @Param req query paginator.Pagination false "pagination parameters" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions [get] -func (_i *chatHistoryController) GetUserSessions(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - authHeader := c.Get("Authorization") - - reqContext := request.ChatHistorySessionsQueryRequestContext{ - AgentID: c.Query("agent_id"), - SessionID: c.Query("session_id"), - } - req := reqContext.ToParamRequest() - req.Pagination = paginate - - sessionsData, paging, err := _i.chatHistoryService.GetUserSessions(authHeader, req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history sessions successfully retrieved"}, - Data: sessionsData, - Meta: paging, - }) -} - -// Get Session -// @Summary Get one chat history session with messages -// @Description API for getting one chat history session with all its messages -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param sessionId path string true "Session ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions/{sessionId} [get] -func (_i *chatHistoryController) GetSession(c *fiber.Ctx) error { - sessionID := c.Params("sessionId") - if sessionID == "" { - return utilRes.Resp(c, utilRes.Response{ - Success: false, - Messages: utilRes.Messages{"Session ID is required"}, - }) - } - - authHeader := c.Get("Authorization") - - sessionData, err := _i.chatHistoryService.GetSession(authHeader, sessionID) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history session successfully retrieved"}, - Data: sessionData, - }) -} - -// Create Session -// @Summary Create chat history session -// @Description API for create chat history session -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param Authorization header string false "Insert your access token" default(Bearer ) -// @Param payload body request.ChatHistorySessionsCreateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions [post] -func (_i *chatHistoryController) CreateSession(c *fiber.Ctx) error { - req := new(request.ChatHistorySessionsCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authHeader := c.Get("Authorization") - - dataResult, err := _i.chatHistoryService.CreateSession(authHeader, *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history session successfully created"}, - Data: dataResult, - }) -} - -// Update Session -// @Summary Update chat history session -// @Description API for update chat history session -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param sessionId path string true "Session ID" -// @Param payload body request.ChatHistorySessionsUpdateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions/{sessionId} [put] -func (_i *chatHistoryController) UpdateSession(c *fiber.Ctx) error { - sessionID := c.Params("sessionId") - if sessionID == "" { - return utilRes.Resp(c, utilRes.Response{ - Success: false, - Messages: utilRes.Messages{"Session ID is required"}, - }) - } - - req := new(request.ChatHistorySessionsUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authHeader := c.Get("Authorization") - - err := _i.chatHistoryService.UpdateSession(authHeader, sessionID, *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history session successfully updated"}, - }) -} - -// Delete Session -// @Summary Delete chat history session -// @Description API for delete chat history session -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param sessionId path string true "Session ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions/{sessionId} [delete] -func (_i *chatHistoryController) DeleteSession(c *fiber.Ctx) error { - sessionID := c.Params("sessionId") - if sessionID == "" { - return utilRes.Resp(c, utilRes.Response{ - Success: false, - Messages: utilRes.Messages{"Session ID is required"}, - }) - } - - authHeader := c.Get("Authorization") - - err := _i.chatHistoryService.DeleteSession(authHeader, sessionID) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history session successfully deleted"}, - }) -} - -// Get Session Messages -// @Summary Get chat history session messages -// @Description API for getting all messages in a chat history session -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param sessionId path string true "Session ID" -// @Param req query request.ChatHistoryMessagesQueryRequest false "query parameters" -// @Param req query paginator.Pagination false "pagination parameters" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions/{sessionId}/messages [get] -func (_i *chatHistoryController) GetSessionMessages(c *fiber.Ctx) error { - sessionID := c.Params("sessionId") - if sessionID == "" { - return utilRes.Resp(c, utilRes.Response{ - Success: false, - Messages: utilRes.Messages{"Session ID is required"}, - }) - } - - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - authHeader := c.Get("Authorization") - - req := request.ChatHistoryMessagesQueryRequest{ - SessionID: sessionID, - Pagination: paginate, - } - - messagesData, paging, err := _i.chatHistoryService.GetSessionMessages(authHeader, sessionID, req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history messages successfully retrieved"}, - Data: messagesData, - Meta: paging, - }) -} - -// Create Message -// @Summary Create chat history message -// @Description API for creating a message in a chat history session -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param sessionId path string true "Session ID" -// @Param payload body request.ChatHistoryMessagesCreateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/sessions/{sessionId}/messages [post] -func (_i *chatHistoryController) CreateMessage(c *fiber.Ctx) error { - sessionID := c.Params("sessionId") - if sessionID == "" { - return utilRes.Resp(c, utilRes.Response{ - Success: false, - Messages: utilRes.Messages{"Session ID is required"}, - }) - } - - req := new(request.ChatHistoryMessagesCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - // Set session ID from URL parameter - req.SessionID = sessionID - - authHeader := c.Get("Authorization") - - dataResult, err := _i.chatHistoryService.CreateMessage(authHeader, *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history message successfully created"}, - Data: dataResult, - }) -} - -// Update Message -// @Summary Update chat history message -// @Description API for update chat history message -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param messageId path int true "Message ID" -// @Param payload body request.ChatHistoryMessagesUpdateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/messages/{messageId} [put] -func (_i *chatHistoryController) UpdateMessage(c *fiber.Ctx) error { - messageId, err := strconv.ParseUint(c.Params("messageId"), 10, 0) - if err != nil { - return err - } - - req := new(request.ChatHistoryMessagesUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authHeader := c.Get("Authorization") - - if err := _i.chatHistoryService.UpdateMessage(authHeader, uint(messageId), *req); err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history message successfully updated"}, - }) -} - -// Delete Message -// @Summary Delete chat history message -// @Description API for delete chat history message -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param messageId path int true "Message ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/messages/{messageId} [delete] -func (_i *chatHistoryController) DeleteMessage(c *fiber.Ctx) error { - messageId, err := strconv.ParseUint(c.Params("messageId"), 10, 0) - if err != nil { - return err - } - - authHeader := c.Get("Authorization") - - if err := _i.chatHistoryService.DeleteMessage(authHeader, uint(messageId)); err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history message successfully deleted"}, - }) -} - -// Save Chat History -// @Summary Save chat history (sessions and messages) -// @Description API for saving complete chat history including sessions and messages -// @Tags Chat History -// @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" -// @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" -// @Param Authorization header string false "Insert your access token" default(Bearer ) -// @Param payload body request.ChatHistorySessionsCreateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /chat-history/save [post] -func (_i *chatHistoryController) SaveChatHistory(c *fiber.Ctx) error { - req := new(request.ChatHistorySessionsCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authHeader := c.Get("Authorization") - - dataResult, err := _i.chatHistoryService.SaveChatHistory(authHeader, *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Chat history saved successfully"}, - Data: dataResult, - }) -} diff --git a/app/module/chat_history/mapper/chat_history.mapper.go b/app/module/chat_history/mapper/chat_history.mapper.go deleted file mode 100644 index cd58606..0000000 --- a/app/module/chat_history/mapper/chat_history.mapper.go +++ /dev/null @@ -1,77 +0,0 @@ -package mapper - -import ( - "narasi-ahli-be/app/database/entity" - "narasi-ahli-be/app/module/chat_history/response" -) - -// Chat History Sessions Mapper -func ChatHistorySessionsResponseMapper(entity *entity.ChatSessions) *response.ChatHistorySessionsResponse { - if entity == nil { - return nil - } - - return &response.ChatHistorySessionsResponse{ - ID: entity.ID, - SessionID: entity.SessionID, - UserID: entity.UserID, - AgentID: entity.AgentID, - Title: entity.Title, - MessageCount: entity.MessageCount, - Status: entity.Status, - CreatedAt: entity.CreatedAt, - UpdatedAt: entity.UpdatedAt, - } -} - -// Chat History Messages Mapper -func ChatHistoryMessagesResponseMapper(entity *entity.ChatMessagesNew) *response.ChatHistoryMessagesResponse { - if entity == nil { - return nil - } - - return &response.ChatHistoryMessagesResponse{ - ID: entity.ID, - SessionID: entity.SessionID, - MessageType: entity.MessageType, - Content: entity.Content, - CreatedAt: entity.CreatedAt, - } -} - -// Chat History Session with Messages Mapper -func ChatHistorySessionWithMessagesResponseMapper(session *entity.ChatSessions, messages []*entity.ChatMessagesNew) *response.ChatHistorySessionWithMessagesResponse { - if session == nil { - return nil - } - - sessionResponse := ChatHistorySessionsResponseMapper(session) - - var messagesResponse []response.ChatHistoryMessagesResponse - for _, message := range messages { - if message != nil { - messagesResponse = append(messagesResponse, *ChatHistoryMessagesResponseMapper(message)) - } - } - - return &response.ChatHistorySessionWithMessagesResponse{ - Session: *sessionResponse, - Messages: messagesResponse, - } -} - -// Chat History List Mapper -func ChatHistoryListResponseMapper(sessions []*entity.ChatSessions) *response.ChatHistoryListResponse { - var sessionsResponse []response.ChatHistorySessionsResponse - - for _, session := range sessions { - if session != nil { - sessionsResponse = append(sessionsResponse, *ChatHistorySessionsResponseMapper(session)) - } - } - - return &response.ChatHistoryListResponse{ - Sessions: sessionsResponse, - Total: len(sessionsResponse), - } -} diff --git a/app/module/chat_history/repository/chat_history.repository.go b/app/module/chat_history/repository/chat_history.repository.go deleted file mode 100644 index 9c594ad..0000000 --- a/app/module/chat_history/repository/chat_history.repository.go +++ /dev/null @@ -1,159 +0,0 @@ -package repository - -import ( - "narasi-ahli-be/app/database" - "narasi-ahli-be/app/database/entity" - "narasi-ahli-be/app/module/chat_history/request" - "narasi-ahli-be/utils/paginator" -) - -type chatHistoryRepository struct { - DB *database.Database -} - -type ChatHistoryRepository interface { - // Chat Sessions - GetUserSessions(userId uint, req request.ChatHistorySessionsQueryRequest) (sessions []*entity.ChatSessions, paging paginator.Pagination, err error) - FindSessionByID(id uint) (session *entity.ChatSessions, err error) - FindSessionBySessionID(sessionID string) (session *entity.ChatSessions, err error) - FindSessionByUserAndSessionID(userID uint, sessionID string) (session *entity.ChatSessions, err error) - CreateSession(session *entity.ChatSessions) (result *entity.ChatSessions, err error) - UpdateSession(sessionID string, session *entity.ChatSessions) (err error) - DeleteSession(sessionID string) (err error) - IncrementMessageCount(sessionID string) (err error) - - // Chat Messages - GetSessionMessages(sessionID string, req request.ChatHistoryMessagesQueryRequest) (messages []*entity.ChatMessagesNew, paging paginator.Pagination, err error) - CreateMessage(message *entity.ChatMessagesNew) (result *entity.ChatMessagesNew, err error) - UpdateMessage(messageID uint, message *entity.ChatMessagesNew) (err error) - DeleteMessage(messageID uint) (err error) - DeleteMessagesBySessionID(sessionID string) (err error) - GetLastMessage(sessionID string) (message *entity.ChatMessagesNew, err error) -} - -func NewChatHistoryRepository(db *database.Database) ChatHistoryRepository { - return &chatHistoryRepository{ - DB: db, - } -} - -// Chat Sessions methods -func (_i *chatHistoryRepository) GetUserSessions(userId uint, req request.ChatHistorySessionsQueryRequest) (sessions []*entity.ChatSessions, paging paginator.Pagination, err error) { - query := _i.DB.DB.Where("user_id = ?", userId) - - // Apply filters - if req.AgentID != nil { - query = query.Where("agent_id = ?", *req.AgentID) - } - if req.SessionID != nil { - query = query.Where("session_id = ?", *req.SessionID) - } - - // Include user relationship - query = query.Preload("User") - - // Order by updated_at desc (most recent first) - query = query.Order("updated_at DESC") - - // Apply pagination - var count int64 - query.Count(&count) - req.Pagination.Count = count - req.Pagination = paginator.Paging(req.Pagination) - - err = query.Offset(req.Pagination.Offset).Limit(req.Pagination.Limit).Find(&sessions).Error - paging = *req.Pagination - - return -} - -func (_i *chatHistoryRepository) FindSessionByID(id uint) (session *entity.ChatSessions, err error) { - err = _i.DB.DB.Where("id = ?", id).Preload("User").First(&session).Error - return -} - -func (_i *chatHistoryRepository) FindSessionBySessionID(sessionID string) (session *entity.ChatSessions, err error) { - err = _i.DB.DB.Where("session_id = ?", sessionID).Preload("User").First(&session).Error - return -} - -func (_i *chatHistoryRepository) FindSessionByUserAndSessionID(userID uint, sessionID string) (session *entity.ChatSessions, err error) { - err = _i.DB.DB.Where("user_id = ? AND session_id = ?", userID, sessionID).Preload("User").First(&session).Error - return -} - -func (_i *chatHistoryRepository) CreateSession(session *entity.ChatSessions) (result *entity.ChatSessions, err error) { - err = _i.DB.DB.Create(session).Error - if err != nil { - return nil, err - } - - // Reload with relationships - err = _i.DB.DB.Preload("User").First(&result, session.ID).Error - return -} - -func (_i *chatHistoryRepository) UpdateSession(sessionID string, session *entity.ChatSessions) (err error) { - err = _i.DB.DB.Where("session_id = ?", sessionID).Updates(session).Error - return -} - -func (_i *chatHistoryRepository) DeleteSession(sessionID string) (err error) { - err = _i.DB.DB.Where("session_id = ?", sessionID).Delete(&entity.ChatSessions{}).Error - return -} - -func (_i *chatHistoryRepository) IncrementMessageCount(sessionID string) (err error) { - err = _i.DB.DB.Exec("UPDATE chat_sessions SET message_count = message_count + 1 WHERE session_id = ?", sessionID).Error - return -} - -// Chat Messages methods -func (_i *chatHistoryRepository) GetSessionMessages(sessionID string, req request.ChatHistoryMessagesQueryRequest) (messages []*entity.ChatMessagesNew, paging paginator.Pagination, err error) { - query := _i.DB.DB.Where("session_id = ?", sessionID) - - // Order by created_at asc (oldest first for chat) - query = query.Order("created_at ASC") - - // Apply pagination - var count int64 - query.Count(&count) - req.Pagination.Count = count - req.Pagination = paginator.Paging(req.Pagination) - - err = query.Offset(req.Pagination.Offset).Limit(req.Pagination.Limit).Find(&messages).Error - paging = *req.Pagination - - return -} - -func (_i *chatHistoryRepository) CreateMessage(message *entity.ChatMessagesNew) (result *entity.ChatMessagesNew, err error) { - err = _i.DB.DB.Create(message).Error - if err != nil { - return nil, err - } - - // Reload - err = _i.DB.DB.First(&result, message.ID).Error - return -} - -func (_i *chatHistoryRepository) UpdateMessage(messageID uint, message *entity.ChatMessagesNew) (err error) { - err = _i.DB.DB.Model(&entity.ChatMessagesNew{}).Where("id = ?", messageID).Updates(message).Error - return -} - -func (_i *chatHistoryRepository) DeleteMessage(messageID uint) (err error) { - err = _i.DB.DB.Where("id = ?", messageID).Delete(&entity.ChatMessagesNew{}).Error - return -} - -func (_i *chatHistoryRepository) DeleteMessagesBySessionID(sessionID string) (err error) { - err = _i.DB.DB.Where("session_id = ?", sessionID).Delete(&entity.ChatMessagesNew{}).Error - return -} - -func (_i *chatHistoryRepository) GetLastMessage(sessionID string) (message *entity.ChatMessagesNew, err error) { - err = _i.DB.DB.Where("session_id = ?", sessionID).Order("created_at DESC").First(&message).Error - return -} diff --git a/app/module/chat_history/request/chat_history.request.go b/app/module/chat_history/request/chat_history.request.go deleted file mode 100644 index 269d809..0000000 --- a/app/module/chat_history/request/chat_history.request.go +++ /dev/null @@ -1,131 +0,0 @@ -package request - -import ( - "narasi-ahli-be/app/database/entity" - "narasi-ahli-be/utils/paginator" -) - -// Chat History Sessions Request DTOs -type ChatHistorySessionsQueryRequest struct { - UserID *uint `json:"userId"` - AgentID *string `json:"agentId"` - SessionID *string `json:"sessionId"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type ChatHistorySessionsCreateRequest struct { - UserID uint `json:"userId" validate:"required"` - AgentID string `json:"agentId" validate:"required"` - SessionID string `json:"sessionId" validate:"required"` - Title *string `json:"title"` - Messages []ChatMessageRequest `json:"messages"` -} - -type ChatMessageRequest struct { - Type string `json:"type" validate:"required,oneof=user assistant"` - Content string `json:"content" validate:"required"` -} - -func (req ChatHistorySessionsCreateRequest) ToEntity() *entity.ChatSessions { - title := "Chat Session" - if req.Title != nil { - title = *req.Title - } - - return &entity.ChatSessions{ - SessionID: req.SessionID, - UserID: req.UserID, - AgentID: req.AgentID, - Title: title, - MessageCount: len(req.Messages), - Status: "active", - } -} - -type ChatHistorySessionsUpdateRequest struct { - Title *string `json:"title"` - Status *string `json:"status" validate:"omitempty,oneof=active archived deleted"` -} - -func (req ChatHistorySessionsUpdateRequest) ToEntity() *entity.ChatSessions { - entity := &entity.ChatSessions{} - - if req.Title != nil { - entity.Title = *req.Title - } - if req.Status != nil { - entity.Status = *req.Status - } - - return entity -} - -// Chat History Messages Request DTOs -type ChatHistoryMessagesQueryRequest struct { - SessionID string `json:"sessionId" validate:"required"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type ChatHistoryMessagesCreateRequest struct { - SessionID string `json:"sessionId" validate:"required"` - MessageType string `json:"messageType" validate:"required,oneof=user assistant"` - Content string `json:"content" validate:"required"` -} - -func (req ChatHistoryMessagesCreateRequest) ToEntity() *entity.ChatMessagesNew { - return &entity.ChatMessagesNew{ - SessionID: req.SessionID, - MessageType: req.MessageType, - Content: req.Content, - } -} - -type ChatHistoryMessagesUpdateRequest struct { - Content string `json:"content" validate:"required"` -} - -func (req ChatHistoryMessagesUpdateRequest) ToEntity() *entity.ChatMessagesNew { - return &entity.ChatMessagesNew{ - Content: req.Content, - } -} - -// Context Request DTOs for query parameters -type ChatHistorySessionsQueryRequestContext struct { - UserID string `json:"userId"` - AgentID string `json:"agentId"` - SessionID string `json:"sessionId"` -} - -func (req ChatHistorySessionsQueryRequestContext) ToParamRequest() ChatHistorySessionsQueryRequest { - var request ChatHistorySessionsQueryRequest - - if userIDStr := req.UserID; userIDStr != "" { - // Parse user ID from string to uint - // This will be handled in the controller - } - - if agentID := req.AgentID; agentID != "" { - request.AgentID = &agentID - } - - if sessionID := req.SessionID; sessionID != "" { - request.SessionID = &sessionID - } - - return request -} - -type ChatHistoryMessagesQueryRequestContext struct { - SessionID string `json:"sessionId"` -} - -func (req ChatHistoryMessagesQueryRequestContext) ToParamRequest() ChatHistoryMessagesQueryRequest { - var request ChatHistoryMessagesQueryRequest - - if sessionID := req.SessionID; sessionID != "" { - request.SessionID = sessionID - } - - return request -} diff --git a/app/module/chat_history/response/chat_history.response.go b/app/module/chat_history/response/chat_history.response.go deleted file mode 100644 index 6aa169e..0000000 --- a/app/module/chat_history/response/chat_history.response.go +++ /dev/null @@ -1,39 +0,0 @@ -package response - -import ( - "time" -) - -// Chat History Sessions Response DTOs -type ChatHistorySessionsResponse struct { - ID uint `json:"id"` - SessionID string `json:"sessionId"` - UserID uint `json:"userId"` - AgentID string `json:"agentId"` - Title string `json:"title"` - MessageCount int `json:"messageCount"` - Status string `json:"status"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` -} - -// Chat History Messages Response DTOs -type ChatHistoryMessagesResponse struct { - ID uint `json:"id"` - SessionID string `json:"sessionId"` - MessageType string `json:"messageType"` - Content string `json:"content"` - CreatedAt time.Time `json:"createdAt"` -} - -// Combined Response for Session with Messages -type ChatHistorySessionWithMessagesResponse struct { - Session ChatHistorySessionsResponse `json:"session"` - Messages []ChatHistoryMessagesResponse `json:"messages"` -} - -// Chat History List Response -type ChatHistoryListResponse struct { - Sessions []ChatHistorySessionsResponse `json:"sessions"` - Total int `json:"total"` -} diff --git a/app/module/chat_history/service/chat_history.service.go b/app/module/chat_history/service/chat_history.service.go deleted file mode 100644 index 0caf1c8..0000000 --- a/app/module/chat_history/service/chat_history.service.go +++ /dev/null @@ -1,317 +0,0 @@ -package service - -import ( - "errors" - "narasi-ahli-be/app/database/entity" - "narasi-ahli-be/app/module/chat_history/mapper" - "narasi-ahli-be/app/module/chat_history/repository" - "narasi-ahli-be/app/module/chat_history/request" - "narasi-ahli-be/app/module/chat_history/response" - usersRepository "narasi-ahli-be/app/module/users/repository" - "narasi-ahli-be/utils/paginator" - utilSvc "narasi-ahli-be/utils/service" - - "github.com/rs/zerolog" -) - -type chatHistoryService struct { - Repo repository.ChatHistoryRepository - UsersRepo usersRepository.UsersRepository - Log zerolog.Logger -} - -type ChatHistoryService interface { - // Sessions - GetUserSessions(authToken string, req request.ChatHistorySessionsQueryRequest) (sessions []*response.ChatHistorySessionsResponse, paging paginator.Pagination, err error) - GetSession(authToken string, sessionID string) (session *response.ChatHistorySessionWithMessagesResponse, err error) - CreateSession(authToken string, req request.ChatHistorySessionsCreateRequest) (session *response.ChatHistorySessionsResponse, err error) - UpdateSession(authToken string, sessionID string, req request.ChatHistorySessionsUpdateRequest) (err error) - DeleteSession(authToken string, sessionID string) error - - // Messages - GetSessionMessages(authToken string, sessionID string, req request.ChatHistoryMessagesQueryRequest) (messages []*response.ChatHistoryMessagesResponse, paging paginator.Pagination, err error) - CreateMessage(authToken string, req request.ChatHistoryMessagesCreateRequest) (message *response.ChatHistoryMessagesResponse, err error) - UpdateMessage(authToken string, messageID uint, req request.ChatHistoryMessagesUpdateRequest) (err error) - DeleteMessage(authToken string, messageID uint) error - - // Combined operations - SaveChatHistory(authToken string, req request.ChatHistorySessionsCreateRequest) (session *response.ChatHistorySessionsResponse, err error) -} - -func NewChatHistoryService(repo repository.ChatHistoryRepository, usersRepo usersRepository.UsersRepository, log zerolog.Logger) ChatHistoryService { - return &chatHistoryService{ - Repo: repo, - UsersRepo: usersRepo, - Log: log, - } -} - -// Sessions methods -func (_i *chatHistoryService) GetUserSessions(authToken string, req request.ChatHistorySessionsQueryRequest) (sessions []*response.ChatHistorySessionsResponse, paging paginator.Pagination, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Set user ID from auth token - req.UserID = &userInfo.ID - - results, paging, err := _i.Repo.GetUserSessions(userInfo.ID, req) - if err != nil { - return - } - - for _, result := range results { - sessions = append(sessions, mapper.ChatHistorySessionsResponseMapper(result)) - } - - return -} - -func (_i *chatHistoryService) GetSession(authToken string, sessionID string) (session *response.ChatHistorySessionWithMessagesResponse, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Verify session belongs to user - sessionEntity, err := _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, sessionID) - if err != nil { - return nil, err - } - - // Get messages for this session - messagesReq := request.ChatHistoryMessagesQueryRequest{ - SessionID: sessionID, - Pagination: &paginator.Pagination{ - Limit: 1000, // Get all messages for now - }, - } - messages, _, err := _i.Repo.GetSessionMessages(sessionID, messagesReq) - if err != nil { - return nil, err - } - - return mapper.ChatHistorySessionWithMessagesResponseMapper(sessionEntity, messages), nil -} - -func (_i *chatHistoryService) CreateSession(authToken string, req request.ChatHistorySessionsCreateRequest) (session *response.ChatHistorySessionsResponse, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Set user ID from auth token - req.UserID = userInfo.ID - - entity := req.ToEntity() - - result, err := _i.Repo.CreateSession(entity) - if err != nil { - return nil, err - } - - return mapper.ChatHistorySessionsResponseMapper(result), nil -} - -func (_i *chatHistoryService) UpdateSession(authToken string, sessionID string, req request.ChatHistorySessionsUpdateRequest) (err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Interface("data", req).Msg("Updating chat history session") - - // Check if session exists and belongs to user - existing, err := _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, sessionID) - if err != nil { - return err - } - if existing == nil { - return errors.New("chat history session not found") - } - - entity := req.ToEntity() - return _i.Repo.UpdateSession(sessionID, entity) -} - -func (_i *chatHistoryService) DeleteSession(authToken string, sessionID string) error { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Uint("userId", userInfo.ID).Str("sessionId", sessionID).Msg("Deleting chat history session") - - // Check if session exists and belongs to user - existing, err := _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, sessionID) - if err != nil { - return err - } - if existing == nil { - return errors.New("chat history session not found") - } - - return _i.Repo.DeleteSession(sessionID) -} - -// Messages methods -func (_i *chatHistoryService) GetSessionMessages(authToken string, sessionID string, req request.ChatHistoryMessagesQueryRequest) (messages []*response.ChatHistoryMessagesResponse, paging paginator.Pagination, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, sessionID) - if err != nil { - return nil, paginator.Pagination{}, err - } - - results, paging, err := _i.Repo.GetSessionMessages(sessionID, req) - if err != nil { - return - } - - for _, result := range results { - messages = append(messages, mapper.ChatHistoryMessagesResponseMapper(result)) - } - - return -} - -func (_i *chatHistoryService) CreateMessage(authToken string, req request.ChatHistoryMessagesCreateRequest) (message *response.ChatHistoryMessagesResponse, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Interface("data", req).Msg("Creating chat history message") - - // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, req.SessionID) - if err != nil { - return nil, err - } - - entity := req.ToEntity() - - result, err := _i.Repo.CreateMessage(entity) - if err != nil { - return nil, err - } - - // Increment message count in session - err = _i.Repo.IncrementMessageCount(req.SessionID) - if err != nil { - _i.Log.Error().Err(err).Msg("Failed to increment message count") - } - - return mapper.ChatHistoryMessagesResponseMapper(result), nil -} - -func (_i *chatHistoryService) UpdateMessage(authToken string, messageID uint, req request.ChatHistoryMessagesUpdateRequest) (err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Get message to verify it belongs to user's session - messages, _, err := _i.Repo.GetSessionMessages("", request.ChatHistoryMessagesQueryRequest{}) - if err != nil { - return err - } - - // Find the specific message - var targetMessage *entity.ChatMessagesNew - for _, msg := range messages { - if msg.ID == messageID { - targetMessage = msg - break - } - } - - if targetMessage == nil { - return errors.New("message not found") - } - - // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, targetMessage.SessionID) - if err != nil { - return err - } - - entity := req.ToEntity() - return _i.Repo.UpdateMessage(messageID, entity) -} - -func (_i *chatHistoryService) DeleteMessage(authToken string, messageID uint) error { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - - // Get message to verify it belongs to user's session - messages, _, err := _i.Repo.GetSessionMessages("", request.ChatHistoryMessagesQueryRequest{}) - if err != nil { - return err - } - - // Find the specific message - var targetMessage *entity.ChatMessagesNew - for _, msg := range messages { - if msg.ID == messageID { - targetMessage = msg - break - } - } - - if targetMessage == nil { - return errors.New("message not found") - } - - // Verify session belongs to user - _, err = _i.Repo.FindSessionByUserAndSessionID(userInfo.ID, targetMessage.SessionID) - if err != nil { - return err - } - - return _i.Repo.DeleteMessage(messageID) -} - -// Combined operations -func (_i *chatHistoryService) SaveChatHistory(authToken string, req request.ChatHistorySessionsCreateRequest) (session *response.ChatHistorySessionsResponse, err error) { - userInfo := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - _i.Log.Info().Interface("data", req).Msg("Saving chat history") - - // Set user ID from auth token - req.UserID = userInfo.ID - - // Check if session already exists - existingSession, err := _i.Repo.FindSessionBySessionID(req.SessionID) - if err == nil && existingSession != nil { - // Update existing session - updateReq := request.ChatHistorySessionsUpdateRequest{ - Title: req.Title, - } - err = _i.UpdateSession(authToken, req.SessionID, updateReq) - if err != nil { - return nil, err - } - - // Delete existing messages - err = _i.Repo.DeleteMessagesBySessionID(req.SessionID) - if err != nil { - _i.Log.Error().Err(err).Msg("Failed to delete existing messages") - } - } else { - // Create new session - entity := req.ToEntity() - _, err = _i.Repo.CreateSession(entity) - if err != nil { - return nil, err - } - } - - // Save messages if provided - if len(req.Messages) > 0 { - for _, msgReq := range req.Messages { - messageEntity := &entity.ChatMessagesNew{ - SessionID: req.SessionID, - MessageType: msgReq.Type, - Content: msgReq.Content, - } - - _, err = _i.Repo.CreateMessage(messageEntity) - if err != nil { - _i.Log.Error().Err(err).Msg("Failed to create message") - } - } - - // Update message count - err = _i.Repo.UpdateSession(req.SessionID, &entity.ChatSessions{ - MessageCount: len(req.Messages), - }) - if err != nil { - _i.Log.Error().Err(err).Msg("Failed to update message count") - } - } - - // Return the session - result, err := _i.Repo.FindSessionBySessionID(req.SessionID) - if err != nil { - return nil, err - } - - return mapper.ChatHistorySessionsResponseMapper(result), nil -} diff --git a/app/module/custom_static_pages/controller/custom_static_pages.controller.go b/app/module/custom_static_pages/controller/custom_static_pages.controller.go index e11edde..6c620b8 100644 --- a/app/module/custom_static_pages/controller/custom_static_pages.controller.go +++ b/app/module/custom_static_pages/controller/custom_static_pages.controller.go @@ -1,7 +1,7 @@ package controller import ( - "narasi-ahli-be/app/module/custom_static_pages/request" + "narasi-ahli-be/app/module/custom_static_pages/request" "narasi-ahli-be/app/module/custom_static_pages/service" "narasi-ahli-be/utils/paginator" "strconv" @@ -39,7 +39,6 @@ func NewCustomStaticPagesController(customStaticPagesService service.CustomStati // @Description API for getting all CustomStaticPages // @Tags CustomStaticPages // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.CustomStaticPagesQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -63,7 +62,7 @@ func (_i *customStaticPagesController) All(c *fiber.Ctx) error { req.Pagination = paginate // Get from context - customStaticPagesData, paging, err := _i.customStaticPagesService.All(req) + customStaticPagesData, paging, err := _i.customStaticPagesService.All(req) if err != nil { return err } @@ -81,7 +80,6 @@ func (_i *customStaticPagesController) All(c *fiber.Ctx) error { // @Description API for getting one CustomStaticPages // @Tags CustomStaticPages // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "CustomStaticPages ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -95,7 +93,7 @@ func (_i *customStaticPagesController) Show(c *fiber.Ctx) error { } // Get from context - customStaticPagesData, err := _i.customStaticPagesService.Show(uint(id)) + customStaticPagesData, err := _i.customStaticPagesService.Show(uint(id)) if err != nil { return err } @@ -112,7 +110,6 @@ func (_i *customStaticPagesController) Show(c *fiber.Ctx) error { // @Description API for getting one CustomStaticPages // @Tags CustomStaticPages // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param slug path string true "CustomStaticPages Slug" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -123,7 +120,7 @@ func (_i *customStaticPagesController) ShowBySlug(c *fiber.Ctx) error { slug := c.Params("slug") // Get from context - customStaticPagesData, err := _i.customStaticPagesService.ShowBySlug(slug) + customStaticPagesData, err := _i.customStaticPagesService.ShowBySlug(slug) if err != nil { return err } @@ -140,7 +137,6 @@ func (_i *customStaticPagesController) ShowBySlug(c *fiber.Ctx) error { // @Description API for create CustomStaticPages // @Tags CustomStaticPages // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.CustomStaticPagesCreateRequest true "Required payload" // @Success 200 {object} response.Response @@ -155,7 +151,7 @@ func (_i *customStaticPagesController) Save(c *fiber.Ctx) error { } // Get from context - authToken := c.Get("Authorization") + authToken := c.Get("Authorization") dataResult, err := _i.customStaticPagesService.Save(*req, authToken) if err != nil { return err @@ -173,7 +169,6 @@ func (_i *customStaticPagesController) Save(c *fiber.Ctx) error { // @Description API for update CustomStaticPages // @Tags CustomStaticPages // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.CustomStaticPagesUpdateRequest true "Required payload" // @Param id path int true "CustomStaticPages ID" @@ -194,7 +189,7 @@ func (_i *customStaticPagesController) Update(c *fiber.Ctx) error { } // Get from context - err = _i.customStaticPagesService.Update(uint(id), *req) + err = _i.customStaticPagesService.Update(uint(id), *req) if err != nil { return err } @@ -210,7 +205,6 @@ func (_i *customStaticPagesController) Update(c *fiber.Ctx) error { // @Description API for delete CustomStaticPages // @Tags CustomStaticPages // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "CustomStaticPages ID" // @Success 200 {object} response.Response @@ -225,7 +219,7 @@ func (_i *customStaticPagesController) Delete(c *fiber.Ctx) error { } // Get from context - err = _i.customStaticPagesService.Delete(uint(id)) + err = _i.customStaticPagesService.Delete(uint(id)) if err != nil { return err } diff --git a/app/module/education_history/controller/education_history.controller.go b/app/module/education_history/controller/education_history.controller.go index 96afdb7..56550ad 100644 --- a/app/module/education_history/controller/education_history.controller.go +++ b/app/module/education_history/controller/education_history.controller.go @@ -35,7 +35,6 @@ func NewEducationHistoryController(educationHistoryService service.EducationHist // @Description API for getting all Education History for authenticated user // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.EducationHistoryQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -78,7 +77,6 @@ func (_i *educationHistoryController) All(c *fiber.Ctx) error { // @Description API for getting one Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Education History ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -110,7 +108,6 @@ func (_i *educationHistoryController) Show(c *fiber.Ctx) error { // @Description API for create Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.EducationHistoryCreateRequest true "Required payload" @@ -144,7 +141,6 @@ func (_i *educationHistoryController) Save(c *fiber.Ctx) error { // @Description API for update Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Education History ID" // @Param payload body request.EducationHistoryUpdateRequest true "Required payload" @@ -182,7 +178,6 @@ func (_i *educationHistoryController) Update(c *fiber.Ctx) error { // @Description API for delete Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Education History ID" // @Success 200 {object} response.Response @@ -214,7 +209,6 @@ func (_i *educationHistoryController) Delete(c *fiber.Ctx) error { // @Description API for upload certificate image for Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Education History ID" // @Param certificate formData file true "Certificate image file" diff --git a/app/module/feedbacks/controller/feedbacks.controller.go b/app/module/feedbacks/controller/feedbacks.controller.go index 6cf964d..b0903f2 100644 --- a/app/module/feedbacks/controller/feedbacks.controller.go +++ b/app/module/feedbacks/controller/feedbacks.controller.go @@ -38,7 +38,6 @@ func NewFeedbacksController(feedbacksService service.FeedbacksService, log zerol // @Description API for getting all Feedbacks // @Tags Feedbacks // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.FeedbacksQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -79,7 +78,6 @@ func (_i *feedbacksController) All(c *fiber.Ctx) error { // @Description API for getting one Feedbacks // @Tags Feedbacks // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Feedbacks ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -109,7 +107,6 @@ func (_i *feedbacksController) Show(c *fiber.Ctx) error { // @Description API for create Feedbacks // @Tags Feedbacks // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.FeedbacksCreateRequest true "Required payload" @@ -143,7 +140,6 @@ func (_i *feedbacksController) Save(c *fiber.Ctx) error { // @Description API for update Feedbacks // @Tags Feedbacks // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.FeedbacksUpdateRequest true "Required payload" // @Param id path int true "Feedbacks ID" @@ -179,7 +175,6 @@ func (_i *feedbacksController) Update(c *fiber.Ctx) error { // @Description API for delete Feedbacks // @Tags Feedbacks // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Feedbacks ID" // @Success 200 {object} response.Response @@ -209,7 +204,6 @@ func (_i *feedbacksController) Delete(c *fiber.Ctx) error { // @Description API for FeedbackMonthlyStats of Feedbacks // @Tags Feedbacks // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param year query int false "year" // @Success 200 {object} response.Response diff --git a/app/module/magazines/controller/magazines.controller.go b/app/module/magazines/controller/magazines.controller.go index e501a77..6af965e 100644 --- a/app/module/magazines/controller/magazines.controller.go +++ b/app/module/magazines/controller/magazines.controller.go @@ -37,7 +37,6 @@ func NewMagazinesController(magazinesService service.MagazinesService) Magazines // @Description API for getting all Magazines // @Tags Magazines // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.MagazinesQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -78,7 +77,6 @@ func (_i *magazinesController) All(c *fiber.Ctx) error { // @Description API for getting one Magazines // @Tags Magazines // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Magazines ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -107,7 +105,6 @@ func (_i *magazinesController) Show(c *fiber.Ctx) error { // @Description API for create Magazines // @Tags Magazines // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.MagazinesCreateRequest true "Required payload" @@ -141,7 +138,6 @@ func (_i *magazinesController) Save(c *fiber.Ctx) error { // @Description API for update Magazines // @Tags Magazines // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Magazines ID" // @Param payload body request.MagazinesUpdateRequest true "Required payload" @@ -177,7 +173,6 @@ func (_i *magazinesController) Update(c *fiber.Ctx) error { // @Tags Magazines // @Security Bearer // @Produce json -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Magazine ID" // @Param files formData file true "Upload thumbnail" @@ -203,7 +198,6 @@ func (_i *magazinesController) SaveThumbnail(c *fiber.Ctx) error { // @Description API for View Thumbnail of Magazines // @Tags Magazines // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param thumbnailName path string true "Magazines Thumbnail Name" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -219,7 +213,6 @@ func (_i *magazinesController) Viewer(c *fiber.Ctx) error { // @Description API for delete Magazines // @Tags Magazines // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Magazines ID" // @Success 200 {object} response.Response diff --git a/app/module/research_journals/controller/research_journals.controller.go b/app/module/research_journals/controller/research_journals.controller.go index 9f6a990..b156d10 100644 --- a/app/module/research_journals/controller/research_journals.controller.go +++ b/app/module/research_journals/controller/research_journals.controller.go @@ -34,7 +34,6 @@ func NewResearchJournalsController(researchJournalsService service.ResearchJourn // @Description API for getting all Research Journals for authenticated user // @Tags Research Journals // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.ResearchJournalsQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -83,7 +82,6 @@ func (_i *researchJournalsController) All(c *fiber.Ctx) error { // @Description API for getting one Research Journal // @Tags Research Journals // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Research Journal ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -115,7 +113,6 @@ func (_i *researchJournalsController) Show(c *fiber.Ctx) error { // @Description API for create Research Journal // @Tags Research Journals // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.ResearchJournalsCreateRequest true "Required payload" @@ -149,7 +146,6 @@ func (_i *researchJournalsController) Save(c *fiber.Ctx) error { // @Description API for update Research Journal // @Tags Research Journals // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Research Journal ID" // @Param payload body request.ResearchJournalsUpdateRequest true "Required payload" @@ -187,7 +183,6 @@ func (_i *researchJournalsController) Update(c *fiber.Ctx) error { // @Description API for delete Research Journal // @Tags Research Journals // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Research Journal ID" // @Success 200 {object} response.Response diff --git a/app/module/subscription/controller/subscription.controller.go b/app/module/subscription/controller/subscription.controller.go index f9c7e5f..08e723f 100644 --- a/app/module/subscription/controller/subscription.controller.go +++ b/app/module/subscription/controller/subscription.controller.go @@ -37,7 +37,6 @@ func NewSubscriptionController(subscriptionService service.SubscriptionService, // @Description API for getting all Subscription // @Tags Subscription // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.SubscriptionQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -75,7 +74,6 @@ func (_i *subscriptionController) All(c *fiber.Ctx) error { // @Description API for getting one Subscription // @Tags Subscription // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Subscription ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -105,7 +103,6 @@ func (_i *subscriptionController) Show(c *fiber.Ctx) error { // @Description API for create Subscription // @Tags Subscription // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.SubscriptionCreateRequest true "Required payload" // @Success 200 {object} response.Response @@ -136,7 +133,6 @@ func (_i *subscriptionController) Save(c *fiber.Ctx) error { // @Description API for update Subscription // @Tags Subscription // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.SubscriptionUpdateRequest true "Required payload" // @Param id path int true "Subscription ID" @@ -172,7 +168,6 @@ func (_i *subscriptionController) Update(c *fiber.Ctx) error { // @Description API for delete Subscription // @Tags Subscription // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Subscription ID" // @Success 200 {object} response.Response diff --git a/app/module/users/controller/users.controller.go b/app/module/users/controller/users.controller.go index 8a74be5..d7c2721 100644 --- a/app/module/users/controller/users.controller.go +++ b/app/module/users/controller/users.controller.go @@ -47,7 +47,6 @@ func NewUsersController(usersService service.UsersService) UsersController { // @Description API for getting all Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.UsersQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -96,7 +95,6 @@ func (_i *usersController) All(c *fiber.Ctx) error { // @Description API for getting one Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Users ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -126,7 +124,6 @@ func (_i *usersController) Show(c *fiber.Ctx) error { // @Description API for getting one Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param username path string true "Username" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -153,7 +150,6 @@ func (_i *usersController) ShowByUsername(c *fiber.Ctx) error { // @Description API for ShowUserInfo // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -180,7 +176,6 @@ func (_i *usersController) ShowInfo(c *fiber.Ctx) error { // @Description API for create Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.UsersCreateRequest true "Required payload" @@ -214,7 +209,6 @@ func (_i *usersController) Save(c *fiber.Ctx) error { // @Description API for update Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Users ID" // @Param payload body request.UsersUpdateRequest true "Required payload" @@ -318,7 +312,6 @@ func (_i *usersController) ParetoLogin(c *fiber.Ctx) error { // @Description API for delete Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Users ID" // @Success 200 {object} response.Response @@ -348,7 +341,6 @@ func (_i *usersController) Delete(c *fiber.Ctx) error { // @Description API for SavePassword Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.UserSavePassword true "Required payload" @@ -410,7 +402,6 @@ func (_i *usersController) ResetPassword(c *fiber.Ctx) error { // @Description API for ForgotPassword Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.UserForgotPassword true "Required payload" // @Success 200 {object} response.Response @@ -498,7 +489,6 @@ func (_i *usersController) OtpValidation(c *fiber.Ctx) error { // @Description API for Email Validation Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.UserEmailValidationRequest true "Required payload" // @Success 200 {object} response.Response @@ -528,7 +518,6 @@ func (_i *usersController) EmailValidation(c *fiber.Ctx) error { // @Description API for Setup Email Users // @Tags Users // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param payload body request.UserEmailValidationRequest true "Required payload" // @Success 200 {object} response.Response diff --git a/app/module/work_history/controller/work_history.controller.go b/app/module/work_history/controller/work_history.controller.go index 8d6397e..99c96f4 100644 --- a/app/module/work_history/controller/work_history.controller.go +++ b/app/module/work_history/controller/work_history.controller.go @@ -34,7 +34,6 @@ func NewWorkHistoryController(workHistoryService service.WorkHistoryService) Wor // @Description API for getting all Work History for authenticated user // @Tags Work History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.WorkHistoryQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -76,7 +75,6 @@ func (_i *workHistoryController) All(c *fiber.Ctx) error { // @Description API for getting one Work History // @Tags Work History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Work History ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -108,7 +106,6 @@ func (_i *workHistoryController) Show(c *fiber.Ctx) error { // @Description API for create Work History // @Tags Work History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.WorkHistoryCreateRequest true "Required payload" @@ -142,7 +139,6 @@ func (_i *workHistoryController) Save(c *fiber.Ctx) error { // @Description API for update Work History // @Tags Work History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Work History ID" // @Param payload body request.WorkHistoryUpdateRequest true "Required payload" @@ -180,7 +176,6 @@ func (_i *workHistoryController) Update(c *fiber.Ctx) error { // @Description API for delete Work History // @Tags Work History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param id path int true "Work History ID" // @Success 200 {object} response.Response diff --git a/app/router/api.go b/app/router/api.go index c640105..514c801 100644 --- a/app/router/api.go +++ b/app/router/api.go @@ -10,7 +10,6 @@ import ( "narasi-ahli-be/app/module/article_comments" "narasi-ahli-be/app/module/article_files" "narasi-ahli-be/app/module/articles" - "narasi-ahli-be/app/module/chat_history" "narasi-ahli-be/app/module/cities" "narasi-ahli-be/app/module/custom_static_pages" "narasi-ahli-be/app/module/districts" @@ -48,7 +47,6 @@ type Router struct { ArticleCommentsRouter *article_comments.ArticleCommentsRouter ArticleApprovalsRouter *article_approvals.ArticleApprovalsRouter ArticlesRouter *articles.ArticlesRouter - ChatHistoryRouter *chat_history.ChatHistoryRouter CitiesRouter *cities.CitiesRouter CustomStaticPagesRouter *custom_static_pages.CustomStaticPagesRouter DistrictsRouter *districts.DistrictsRouter @@ -81,7 +79,6 @@ func NewRouter( articleCommentsRouter *article_comments.ArticleCommentsRouter, articleApprovalsRouter *article_approvals.ArticleApprovalsRouter, articlesRouter *articles.ArticlesRouter, - chatHistoryRouter *chat_history.ChatHistoryRouter, citiesRouter *cities.CitiesRouter, customStaticPagesRouter *custom_static_pages.CustomStaticPagesRouter, districtsRouter *districts.DistrictsRouter, @@ -112,7 +109,6 @@ func NewRouter( ArticleCommentsRouter: articleCommentsRouter, ArticleApprovalsRouter: articleApprovalsRouter, ArticlesRouter: articlesRouter, - ChatHistoryRouter: chatHistoryRouter, CitiesRouter: citiesRouter, CustomStaticPagesRouter: customStaticPagesRouter, DistrictsRouter: districtsRouter, @@ -153,7 +149,6 @@ func (r *Router) Register() { r.ArticleApprovalsRouter.RegisterArticleApprovalsRoutes() r.ArticlesRouter.RegisterArticlesRoutes() r.ArticleCommentsRouter.RegisterArticleCommentsRoutes() - r.ChatHistoryRouter.RegisterChatHistoryRoutes() r.CitiesRouter.RegisterCitiesRoutes() r.CustomStaticPagesRouter.RegisterCustomStaticPagesRoutes() r.DistrictsRouter.RegisterDistrictsRoutes() diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 3a10467..4a7ea0e 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -28,12 +28,6 @@ const docTemplate = `{ ], "summary": "Get all ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "activityTypeId", @@ -134,12 +128,6 @@ const docTemplate = `{ ], "summary": "Create ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -205,12 +193,6 @@ const docTemplate = `{ ], "summary": "Get one ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ActivityLogs ID", @@ -259,14 +241,6 @@ const docTemplate = `{ "ActivityLogs" ], "summary": "Get activity stats ActivityLogs", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - } - ], "responses": { "200": { "description": "OK", @@ -308,12 +282,6 @@ const docTemplate = `{ ], "summary": "update ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -377,12 +345,6 @@ const docTemplate = `{ ], "summary": "delete ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -439,12 +401,6 @@ const docTemplate = `{ ], "summary": "Get all Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "description", @@ -555,12 +511,6 @@ const docTemplate = `{ ], "summary": "Create Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -626,12 +576,6 @@ const docTemplate = `{ ], "summary": "Update Publish Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -705,12 +649,6 @@ const docTemplate = `{ ], "summary": "Upload Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -774,12 +712,6 @@ const docTemplate = `{ ], "summary": "Viewer Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Content File Name", @@ -829,12 +761,6 @@ const docTemplate = `{ ], "summary": "Get one Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Advertisement ID", @@ -882,12 +808,6 @@ const docTemplate = `{ ], "summary": "update Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -951,12 +871,6 @@ const docTemplate = `{ ], "summary": "delete Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -1015,8 +929,9 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1108,8 +1023,9 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1163,13 +1079,14 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { - "type": "string", - "name": "status", + "type": "boolean", + "name": "isActive", "in": "query" }, { @@ -1252,12 +1169,6 @@ const docTemplate = `{ ], "summary": "Create AI chat session", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -1310,6 +1221,204 @@ const docTemplate = `{ } } }, + "/ai-chat/sessions/messages": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for sending a message to an AI chat session", + "tags": [ + "AI Chat" + ], + "summary": "Send message to AI chat session", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header" + }, + { + "type": "string", + "description": "Insert the X-Csrf-Token", + "name": "X-Csrf-Token", + "in": "header", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AIChatMessagesCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, + "/ai-chat/sessions/messages/{messageId}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for update AI chat message", + "tags": [ + "AI Chat" + ], + "summary": "Update AI chat message", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header" + }, + { + "type": "string", + "description": "Insert the X-Csrf-Token", + "name": "X-Csrf-Token", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Message ID", + "name": "messageId", + "in": "path", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AIChatMessagesUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for delete AI chat message", + "tags": [ + "AI Chat" + ], + "summary": "Delete AI chat message", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header" + }, + { + "type": "string", + "description": "Insert the X-Csrf-Token", + "name": "X-Csrf-Token", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Message ID", + "name": "messageId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/ai-chat/sessions/{id}": { "get": { "security": [ @@ -1325,8 +1434,9 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1378,8 +1488,9 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1447,8 +1558,9 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1509,8 +1621,9 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1521,7 +1634,7 @@ const docTemplate = `{ "required": true }, { - "type": "integer", + "type": "string", "name": "sessionId", "in": "query", "required": true @@ -1593,220 +1706,6 @@ const docTemplate = `{ } } } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for sending a message to an AI chat session", - "tags": [ - "AI Chat" - ], - "summary": "Send message to AI chat session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.AIChatMessagesCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/ai-chat/sessions/{sessionId}/messages/{messageId}": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for update AI chat message", - "tags": [ - "AI Chat" - ], - "summary": "Update AI chat message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.AIChatMessagesUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "delete": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for delete AI chat message", - "tags": [ - "AI Chat" - ], - "summary": "Delete AI chat message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } } }, "/article-approvals": { @@ -1927,12 +1826,6 @@ const docTemplate = `{ ], "summary": "Create ArticleApprovals", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2164,12 +2057,6 @@ const docTemplate = `{ ], "summary": "Get all ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "default": "Bearer \u003cAdd access token here\u003e", @@ -2292,12 +2179,6 @@ const docTemplate = `{ ], "summary": "Create ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2363,12 +2244,6 @@ const docTemplate = `{ ], "summary": "Get one ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleCategories Old ID", @@ -2418,12 +2293,6 @@ const docTemplate = `{ ], "summary": "Get one ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "ArticleCategories Slug", @@ -2473,12 +2342,6 @@ const docTemplate = `{ ], "summary": "Viewer ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "ArticleCategories ID", @@ -2531,12 +2394,6 @@ const docTemplate = `{ ], "summary": "Upload ArticleCategories Thumbnail", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2600,12 +2457,6 @@ const docTemplate = `{ ], "summary": "Get one ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleCategories ID", @@ -2653,12 +2504,6 @@ const docTemplate = `{ ], "summary": "update ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2722,12 +2567,6 @@ const docTemplate = `{ ], "summary": "delete ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3058,12 +2897,6 @@ const docTemplate = `{ ], "summary": "Get all ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "articleId", @@ -3169,12 +3002,6 @@ const docTemplate = `{ ], "summary": "Create ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3240,12 +3067,6 @@ const docTemplate = `{ ], "summary": "Approval ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3304,12 +3125,6 @@ const docTemplate = `{ ], "summary": "Get one ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleComments ID", @@ -3357,12 +3172,6 @@ const docTemplate = `{ ], "summary": "update ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3426,12 +3235,6 @@ const docTemplate = `{ ], "summary": "delete ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3488,12 +3291,6 @@ const docTemplate = `{ ], "summary": "Get all ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "articleId", @@ -3645,12 +3442,6 @@ const docTemplate = `{ ], "summary": "Viewer ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Article File Name", @@ -3703,12 +3494,6 @@ const docTemplate = `{ ], "summary": "Upload ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3772,12 +3557,6 @@ const docTemplate = `{ ], "summary": "Get one ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleFiles ID", @@ -3825,12 +3604,6 @@ const docTemplate = `{ ], "summary": "Update ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3894,12 +3667,6 @@ const docTemplate = `{ ], "summary": "Delete ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -4098,12 +3865,6 @@ const docTemplate = `{ ], "summary": "Create Articles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -4565,12 +4326,6 @@ const docTemplate = `{ ], "summary": "Save Thumbnail Articles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -4787,734 +4542,6 @@ const docTemplate = `{ } } }, - "/chat-history/messages/{messageId}": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for update chat history message", - "tags": [ - "Chat History" - ], - "summary": "Update chat history message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistoryMessagesUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "delete": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for delete chat history message", - "tags": [ - "Chat History" - ], - "summary": "Delete chat history message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/save": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for saving complete chat history including sessions and messages", - "tags": [ - "Chat History" - ], - "summary": "Save chat history (sessions and messages)", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistorySessionsCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/sessions": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all chat history sessions for authenticated user", - "tags": [ - "Chat History" - ], - "summary": "Get user chat history sessions", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "name": "agent_id", - "in": "query" - }, - { - "type": "string", - "name": "session_id", - "in": "query" - }, - { - "type": "integer", - "name": "user_id", - "in": "query" - }, - { - "type": "integer", - "name": "count", - "in": "query" - }, - { - "type": "integer", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "name": "nextPage", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "name": "previousPage", - "in": "query" - }, - { - "type": "string", - "name": "sort", - "in": "query" - }, - { - "type": "string", - "name": "sortBy", - "in": "query" - }, - { - "type": "integer", - "name": "totalPage", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for create chat history session", - "tags": [ - "Chat History" - ], - "summary": "Create chat history session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistorySessionsCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/sessions/{sessionId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one chat history session with all its messages", - "tags": [ - "Chat History" - ], - "summary": "Get one chat history session with messages", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for update chat history session", - "tags": [ - "Chat History" - ], - "summary": "Update chat history session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistorySessionsUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "delete": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for delete chat history session", - "tags": [ - "Chat History" - ], - "summary": "Delete chat history session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/sessions/{sessionId}/messages": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all messages in a chat history session", - "tags": [ - "Chat History" - ], - "summary": "Get chat history session messages", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "session_id", - "in": "query", - "required": true - }, - { - "type": "integer", - "name": "count", - "in": "query" - }, - { - "type": "integer", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "name": "nextPage", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "name": "previousPage", - "in": "query" - }, - { - "type": "string", - "name": "sort", - "in": "query" - }, - { - "type": "string", - "name": "sortBy", - "in": "query" - }, - { - "type": "integer", - "name": "totalPage", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for creating a message in a chat history session", - "tags": [ - "Chat History" - ], - "summary": "Create chat history message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistoryMessagesCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, "/cities": { "get": { "security": [ @@ -5805,12 +4832,6 @@ const docTemplate = `{ ], "summary": "Get all CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "description", @@ -5911,12 +4932,6 @@ const docTemplate = `{ ], "summary": "Create CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -5975,12 +4990,6 @@ const docTemplate = `{ ], "summary": "Get one CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "CustomStaticPages Slug", @@ -6030,12 +5039,6 @@ const docTemplate = `{ ], "summary": "Get one CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "CustomStaticPages ID", @@ -6083,12 +5086,6 @@ const docTemplate = `{ ], "summary": "update CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6152,12 +5149,6 @@ const docTemplate = `{ ], "summary": "delete CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6465,12 +5456,6 @@ const docTemplate = `{ ], "summary": "Get all Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "educationLevel", @@ -6571,12 +5556,6 @@ const docTemplate = `{ ], "summary": "Create Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6642,12 +5621,6 @@ const docTemplate = `{ ], "summary": "Get one Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Education History ID", @@ -6695,12 +5668,6 @@ const docTemplate = `{ ], "summary": "Update Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6764,12 +5731,6 @@ const docTemplate = `{ ], "summary": "Delete Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6826,12 +5787,6 @@ const docTemplate = `{ ], "summary": "Upload Certificate for Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6895,12 +5850,6 @@ const docTemplate = `{ ], "summary": "Get all Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "commentFromEmail", @@ -7011,12 +5960,6 @@ const docTemplate = `{ ], "summary": "Create Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7082,12 +6025,6 @@ const docTemplate = `{ ], "summary": "FeedbackMonthlyStats Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "default": "Bearer \u003cAdd access token here\u003e", @@ -7143,12 +6080,6 @@ const docTemplate = `{ ], "summary": "Get one Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Feedbacks ID", @@ -7196,12 +6127,6 @@ const docTemplate = `{ ], "summary": "update Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7265,12 +6190,6 @@ const docTemplate = `{ ], "summary": "delete Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7650,12 +6569,6 @@ const docTemplate = `{ ], "summary": "Get all Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "createdById", @@ -7776,12 +6689,6 @@ const docTemplate = `{ ], "summary": "Create Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7847,12 +6754,6 @@ const docTemplate = `{ ], "summary": "Viewer Magazines Thumbnail", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Magazines Thumbnail Name", @@ -7905,12 +6806,6 @@ const docTemplate = `{ ], "summary": "Save Thumbnail Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7974,12 +6869,6 @@ const docTemplate = `{ ], "summary": "Get one Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Magazines ID", @@ -8027,12 +6916,6 @@ const docTemplate = `{ ], "summary": "Update Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -8096,12 +6979,6 @@ const docTemplate = `{ ], "summary": "Delete Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9305,12 +8182,6 @@ const docTemplate = `{ ], "summary": "Get all Research Journals", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "journalTitle", @@ -9406,12 +8277,6 @@ const docTemplate = `{ ], "summary": "Create Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9477,12 +8342,6 @@ const docTemplate = `{ ], "summary": "Get one Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Research Journal ID", @@ -9530,12 +8389,6 @@ const docTemplate = `{ ], "summary": "Update Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9599,12 +8452,6 @@ const docTemplate = `{ ], "summary": "Delete Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9661,12 +8508,6 @@ const docTemplate = `{ ], "summary": "Get all Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "email", @@ -9752,12 +8593,6 @@ const docTemplate = `{ ], "summary": "Create Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9816,12 +8651,6 @@ const docTemplate = `{ ], "summary": "Get one Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Subscription ID", @@ -9869,12 +8698,6 @@ const docTemplate = `{ ], "summary": "update Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9938,12 +8761,6 @@ const docTemplate = `{ ], "summary": "delete Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11313,12 +10130,6 @@ const docTemplate = `{ ], "summary": "Get all Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "email", @@ -11459,12 +10270,6 @@ const docTemplate = `{ ], "summary": "Create Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11530,12 +10335,6 @@ const docTemplate = `{ ], "summary": "Get one Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Users ID", @@ -11585,12 +10384,6 @@ const docTemplate = `{ ], "summary": "EmailValidation Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11649,12 +10442,6 @@ const docTemplate = `{ ], "summary": "ForgotPassword Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11713,12 +10500,6 @@ const docTemplate = `{ ], "summary": "ShowInfo Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "default": "Bearer \u003cAdd access token here\u003e", @@ -12058,12 +10839,6 @@ const docTemplate = `{ ], "summary": "SavePassword Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12129,12 +10904,6 @@ const docTemplate = `{ ], "summary": "SetupEmail Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12193,12 +10962,6 @@ const docTemplate = `{ ], "summary": "Get one Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Username", @@ -12248,12 +11011,6 @@ const docTemplate = `{ ], "summary": "update Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12317,12 +11074,6 @@ const docTemplate = `{ ], "summary": "delete Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12379,12 +11130,6 @@ const docTemplate = `{ ], "summary": "Get all Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "companyName", @@ -12481,12 +11226,6 @@ const docTemplate = `{ ], "summary": "Create Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12552,12 +11291,6 @@ const docTemplate = `{ ], "summary": "Get one Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Work History ID", @@ -12605,12 +11338,6 @@ const docTemplate = `{ ], "summary": "Update Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12674,12 +11401,6 @@ const docTemplate = `{ ], "summary": "Delete Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12774,7 +11495,7 @@ const docTemplate = `{ ] }, "sessionId": { - "type": "integer" + "type": "string" } } }, @@ -12793,12 +11514,17 @@ const docTemplate = `{ "request.AIChatSessionsCreateRequest": { "type": "object", "required": [ + "agentId", + "sessionId", "title" ], "properties": { "agentId": { "type": "string" }, + "sessionId": { + "type": "string" + }, "title": { "type": "string", "maxLength": 255, @@ -12809,17 +11535,11 @@ const docTemplate = `{ "request.AIChatSessionsUpdateRequest": { "type": "object", "required": [ - "status", "title" ], "properties": { - "status": { - "type": "string", - "enum": [ - "active", - "archived", - "deleted" - ] + "isActive": { + "type": "boolean" }, "title": { "type": "string", @@ -13262,114 +11982,17 @@ const docTemplate = `{ } } }, - "request.ChatHistoryMessagesCreateRequest": { - "type": "object", - "required": [ - "content", - "message_type", - "session_id" - ], - "properties": { - "content": { - "type": "string" - }, - "message_type": { - "type": "string", - "enum": [ - "user", - "assistant" - ] - }, - "session_id": { - "type": "string" - } - } - }, - "request.ChatHistoryMessagesUpdateRequest": { - "type": "object", - "required": [ - "content" - ], - "properties": { - "content": { - "type": "string" - } - } - }, - "request.ChatHistorySessionsCreateRequest": { - "type": "object", - "required": [ - "agent_id", - "session_id", - "user_id" - ], - "properties": { - "agent_id": { - "type": "string" - }, - "messages": { - "type": "array", - "items": { - "$ref": "#/definitions/request.ChatMessageRequest" - } - }, - "session_id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "user_id": { - "type": "integer" - } - } - }, - "request.ChatHistorySessionsUpdateRequest": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "active", - "archived", - "deleted" - ] - }, - "title": { - "type": "string" - } - } - }, - "request.ChatMessageRequest": { - "type": "object", - "required": [ - "content", - "type" - ], - "properties": { - "content": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "user", - "assistant" - ] - } - } - }, "request.CitiesCreateRequest": { "type": "object", "required": [ - "city_name", - "prov_id" + "cityName", + "provId" ], "properties": { - "city_name": { + "cityName": { "type": "string" }, - "prov_id": { + "provId": { "type": "integer" } } @@ -13377,18 +12000,18 @@ const docTemplate = `{ "request.CitiesUpdateRequest": { "type": "object", "required": [ - "city_name", + "cityName", "id", - "prov_id" + "provId" ], "properties": { - "city_name": { + "cityName": { "type": "string" }, "id": { "type": "integer" }, - "prov_id": { + "provId": { "type": "integer" } } @@ -13439,7 +12062,7 @@ const docTemplate = `{ "title": { "type": "string" }, - "updated_at": { + "updatedAt": { "type": "string" } } @@ -13996,41 +12619,41 @@ const docTemplate = `{ "type": "object", "required": [ "id", - "is_admin_enabled", - "is_approval_enabled", - "is_delete_enabled", - "is_insert_enabled", - "is_update_enabled", - "is_view_enabled", - "menu_id", - "user_role_id" + "isAdminEnabled", + "isApprovalEnabled", + "isDeleteEnabled", + "isInsertEnabled", + "isUpdateEnabled", + "isViewEnabled", + "menuId", + "userRoleId" ], "properties": { "id": { "type": "integer" }, - "is_admin_enabled": { + "isAdminEnabled": { "type": "boolean" }, - "is_approval_enabled": { + "isApprovalEnabled": { "type": "boolean" }, - "is_delete_enabled": { + "isDeleteEnabled": { "type": "boolean" }, - "is_insert_enabled": { + "isInsertEnabled": { "type": "boolean" }, - "is_update_enabled": { + "isUpdateEnabled": { "type": "boolean" }, - "is_view_enabled": { + "isViewEnabled": { "type": "boolean" }, - "menu_id": { + "menuId": { "type": "integer" }, - "user_role_id": { + "userRoleId": { "type": "integer" } } @@ -14077,9 +12700,9 @@ const docTemplate = `{ "required": [ "code", "description", - "level_number", + "levelNumber", "name", - "status_id", + "statusId", "userLevelIds" ], "properties": { @@ -14089,13 +12712,13 @@ const docTemplate = `{ "description": { "type": "string" }, - "level_number": { + "levelNumber": { "type": "integer" }, "name": { "type": "string" }, - "status_id": { + "statusId": { "type": "integer" }, "userLevelIds": { diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index f64cd65..0409db8 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -17,12 +17,6 @@ ], "summary": "Get all ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "activityTypeId", @@ -123,12 +117,6 @@ ], "summary": "Create ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -194,12 +182,6 @@ ], "summary": "Get one ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ActivityLogs ID", @@ -248,14 +230,6 @@ "ActivityLogs" ], "summary": "Get activity stats ActivityLogs", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - } - ], "responses": { "200": { "description": "OK", @@ -297,12 +271,6 @@ ], "summary": "update ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -366,12 +334,6 @@ ], "summary": "delete ActivityLogs", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -428,12 +390,6 @@ ], "summary": "Get all Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "description", @@ -544,12 +500,6 @@ ], "summary": "Create Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -615,12 +565,6 @@ ], "summary": "Update Publish Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -694,12 +638,6 @@ ], "summary": "Upload Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -763,12 +701,6 @@ ], "summary": "Viewer Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Content File Name", @@ -818,12 +750,6 @@ ], "summary": "Get one Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Advertisement ID", @@ -871,12 +797,6 @@ ], "summary": "update Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -940,12 +860,6 @@ ], "summary": "delete Advertisement", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -1004,8 +918,9 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1097,8 +1012,9 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1152,13 +1068,14 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { - "type": "string", - "name": "status", + "type": "boolean", + "name": "isActive", "in": "query" }, { @@ -1241,12 +1158,6 @@ ], "summary": "Create AI chat session", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -1299,6 +1210,204 @@ } } }, + "/ai-chat/sessions/messages": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for sending a message to an AI chat session", + "tags": [ + "AI Chat" + ], + "summary": "Send message to AI chat session", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header" + }, + { + "type": "string", + "description": "Insert the X-Csrf-Token", + "name": "X-Csrf-Token", + "in": "header", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AIChatMessagesCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, + "/ai-chat/sessions/messages/{messageId}": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for update AI chat message", + "tags": [ + "AI Chat" + ], + "summary": "Update AI chat message", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header" + }, + { + "type": "string", + "description": "Insert the X-Csrf-Token", + "name": "X-Csrf-Token", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Message ID", + "name": "messageId", + "in": "path", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.AIChatMessagesUpdateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for delete AI chat message", + "tags": [ + "AI Chat" + ], + "summary": "Delete AI chat message", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header" + }, + { + "type": "string", + "description": "Insert the X-Csrf-Token", + "name": "X-Csrf-Token", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Message ID", + "name": "messageId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/ai-chat/sessions/{id}": { "get": { "security": [ @@ -1314,8 +1423,9 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1367,8 +1477,9 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1436,8 +1547,9 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1498,8 +1610,9 @@ "parameters": [ { "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", "in": "header" }, { @@ -1510,7 +1623,7 @@ "required": true }, { - "type": "integer", + "type": "string", "name": "sessionId", "in": "query", "required": true @@ -1582,220 +1695,6 @@ } } } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for sending a message to an AI chat session", - "tags": [ - "AI Chat" - ], - "summary": "Send message to AI chat session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.AIChatMessagesCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/ai-chat/sessions/{sessionId}/messages/{messageId}": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for update AI chat message", - "tags": [ - "AI Chat" - ], - "summary": "Update AI chat message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.AIChatMessagesUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "delete": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for delete AI chat message", - "tags": [ - "AI Chat" - ], - "summary": "Delete AI chat message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } } }, "/article-approvals": { @@ -1916,12 +1815,6 @@ ], "summary": "Create ArticleApprovals", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2153,12 +2046,6 @@ ], "summary": "Get all ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "default": "Bearer \u003cAdd access token here\u003e", @@ -2281,12 +2168,6 @@ ], "summary": "Create ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2352,12 +2233,6 @@ ], "summary": "Get one ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleCategories Old ID", @@ -2407,12 +2282,6 @@ ], "summary": "Get one ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "ArticleCategories Slug", @@ -2462,12 +2331,6 @@ ], "summary": "Viewer ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "ArticleCategories ID", @@ -2520,12 +2383,6 @@ ], "summary": "Upload ArticleCategories Thumbnail", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2589,12 +2446,6 @@ ], "summary": "Get one ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleCategories ID", @@ -2642,12 +2493,6 @@ ], "summary": "update ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -2711,12 +2556,6 @@ ], "summary": "delete ArticleCategories", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3047,12 +2886,6 @@ ], "summary": "Get all ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "articleId", @@ -3158,12 +2991,6 @@ ], "summary": "Create ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3229,12 +3056,6 @@ ], "summary": "Approval ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3293,12 +3114,6 @@ ], "summary": "Get one ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleComments ID", @@ -3346,12 +3161,6 @@ ], "summary": "update ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3415,12 +3224,6 @@ ], "summary": "delete ArticleComments", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3477,12 +3280,6 @@ ], "summary": "Get all ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "articleId", @@ -3634,12 +3431,6 @@ ], "summary": "Viewer ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Article File Name", @@ -3692,12 +3483,6 @@ ], "summary": "Upload ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3761,12 +3546,6 @@ ], "summary": "Get one ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "ArticleFiles ID", @@ -3814,12 +3593,6 @@ ], "summary": "Update ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -3883,12 +3656,6 @@ ], "summary": "Delete ArticleFiles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -4087,12 +3854,6 @@ ], "summary": "Create Articles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -4554,12 +4315,6 @@ ], "summary": "Save Thumbnail Articles", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -4776,734 +4531,6 @@ } } }, - "/chat-history/messages/{messageId}": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for update chat history message", - "tags": [ - "Chat History" - ], - "summary": "Update chat history message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistoryMessagesUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "delete": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for delete chat history message", - "tags": [ - "Chat History" - ], - "summary": "Delete chat history message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "integer", - "description": "Message ID", - "name": "messageId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/save": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for saving complete chat history including sessions and messages", - "tags": [ - "Chat History" - ], - "summary": "Save chat history (sessions and messages)", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistorySessionsCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/sessions": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all chat history sessions for authenticated user", - "tags": [ - "Chat History" - ], - "summary": "Get user chat history sessions", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "name": "agent_id", - "in": "query" - }, - { - "type": "string", - "name": "session_id", - "in": "query" - }, - { - "type": "integer", - "name": "user_id", - "in": "query" - }, - { - "type": "integer", - "name": "count", - "in": "query" - }, - { - "type": "integer", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "name": "nextPage", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "name": "previousPage", - "in": "query" - }, - { - "type": "string", - "name": "sort", - "in": "query" - }, - { - "type": "string", - "name": "sortBy", - "in": "query" - }, - { - "type": "integer", - "name": "totalPage", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for create chat history session", - "tags": [ - "Chat History" - ], - "summary": "Create chat history session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistorySessionsCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/sessions/{sessionId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one chat history session with all its messages", - "tags": [ - "Chat History" - ], - "summary": "Get one chat history session with messages", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for update chat history session", - "tags": [ - "Chat History" - ], - "summary": "Update chat history session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistorySessionsUpdateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "delete": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for delete chat history session", - "tags": [ - "Chat History" - ], - "summary": "Delete chat history session", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, - "/chat-history/sessions/{sessionId}/messages": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all messages in a chat history session", - "tags": [ - "Chat History" - ], - "summary": "Get chat history session messages", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "session_id", - "in": "query", - "required": true - }, - { - "type": "integer", - "name": "count", - "in": "query" - }, - { - "type": "integer", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "name": "nextPage", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "name": "previousPage", - "in": "query" - }, - { - "type": "string", - "name": "sort", - "in": "query" - }, - { - "type": "string", - "name": "sortBy", - "in": "query" - }, - { - "type": "integer", - "name": "totalPage", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for creating a message in a chat history session", - "tags": [ - "Chat History" - ], - "summary": "Create chat history message", - "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, - { - "type": "string", - "description": "Insert the X-Csrf-Token", - "name": "X-Csrf-Token", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Session ID", - "name": "sessionId", - "in": "path", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.ChatHistoryMessagesCreateRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } - } - } - } - }, "/cities": { "get": { "security": [ @@ -5794,12 +4821,6 @@ ], "summary": "Get all CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "description", @@ -5900,12 +4921,6 @@ ], "summary": "Create CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -5964,12 +4979,6 @@ ], "summary": "Get one CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "CustomStaticPages Slug", @@ -6019,12 +5028,6 @@ ], "summary": "Get one CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "CustomStaticPages ID", @@ -6072,12 +5075,6 @@ ], "summary": "update CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6141,12 +5138,6 @@ ], "summary": "delete CustomStaticPages", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6454,12 +5445,6 @@ ], "summary": "Get all Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "educationLevel", @@ -6560,12 +5545,6 @@ ], "summary": "Create Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6631,12 +5610,6 @@ ], "summary": "Get one Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Education History ID", @@ -6684,12 +5657,6 @@ ], "summary": "Update Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6753,12 +5720,6 @@ ], "summary": "Delete Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6815,12 +5776,6 @@ ], "summary": "Upload Certificate for Education History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -6884,12 +5839,6 @@ ], "summary": "Get all Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "commentFromEmail", @@ -7000,12 +5949,6 @@ ], "summary": "Create Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7071,12 +6014,6 @@ ], "summary": "FeedbackMonthlyStats Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "default": "Bearer \u003cAdd access token here\u003e", @@ -7132,12 +6069,6 @@ ], "summary": "Get one Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Feedbacks ID", @@ -7185,12 +6116,6 @@ ], "summary": "update Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7254,12 +6179,6 @@ ], "summary": "delete Feedbacks", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7639,12 +6558,6 @@ ], "summary": "Get all Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "name": "createdById", @@ -7765,12 +6678,6 @@ ], "summary": "Create Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7836,12 +6743,6 @@ ], "summary": "Viewer Magazines Thumbnail", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Magazines Thumbnail Name", @@ -7894,12 +6795,6 @@ ], "summary": "Save Thumbnail Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -7963,12 +6858,6 @@ ], "summary": "Get one Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Magazines ID", @@ -8016,12 +6905,6 @@ ], "summary": "Update Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -8085,12 +6968,6 @@ ], "summary": "Delete Magazines", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9294,12 +8171,6 @@ ], "summary": "Get all Research Journals", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "journalTitle", @@ -9395,12 +8266,6 @@ ], "summary": "Create Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9466,12 +8331,6 @@ ], "summary": "Get one Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Research Journal ID", @@ -9519,12 +8378,6 @@ ], "summary": "Update Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9588,12 +8441,6 @@ ], "summary": "Delete Research Journal", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9650,12 +8497,6 @@ ], "summary": "Get all Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "email", @@ -9741,12 +8582,6 @@ ], "summary": "Create Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9805,12 +8640,6 @@ ], "summary": "Get one Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Subscription ID", @@ -9858,12 +8687,6 @@ ], "summary": "update Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -9927,12 +8750,6 @@ ], "summary": "delete Subscription", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11302,12 +10119,6 @@ ], "summary": "Get all Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "email", @@ -11448,12 +10259,6 @@ ], "summary": "Create Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11519,12 +10324,6 @@ ], "summary": "Get one Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Users ID", @@ -11574,12 +10373,6 @@ ], "summary": "EmailValidation Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11638,12 +10431,6 @@ ], "summary": "ForgotPassword Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -11702,12 +10489,6 @@ ], "summary": "ShowInfo Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "default": "Bearer \u003cAdd access token here\u003e", @@ -12047,12 +10828,6 @@ ], "summary": "SavePassword Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12118,12 +10893,6 @@ ], "summary": "SetupEmail Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12182,12 +10951,6 @@ ], "summary": "Get one Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Username", @@ -12237,12 +11000,6 @@ ], "summary": "update Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12306,12 +11063,6 @@ ], "summary": "delete Users", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12368,12 +11119,6 @@ ], "summary": "Get all Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "name": "companyName", @@ -12470,12 +11215,6 @@ ], "summary": "Create Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12541,12 +11280,6 @@ ], "summary": "Get one Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "integer", "description": "Work History ID", @@ -12594,12 +11327,6 @@ ], "summary": "Update Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12663,12 +11390,6 @@ ], "summary": "Delete Work History", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header" - }, { "type": "string", "description": "Insert the X-Csrf-Token", @@ -12763,7 +11484,7 @@ ] }, "sessionId": { - "type": "integer" + "type": "string" } } }, @@ -12782,12 +11503,17 @@ "request.AIChatSessionsCreateRequest": { "type": "object", "required": [ + "agentId", + "sessionId", "title" ], "properties": { "agentId": { "type": "string" }, + "sessionId": { + "type": "string" + }, "title": { "type": "string", "maxLength": 255, @@ -12798,17 +11524,11 @@ "request.AIChatSessionsUpdateRequest": { "type": "object", "required": [ - "status", "title" ], "properties": { - "status": { - "type": "string", - "enum": [ - "active", - "archived", - "deleted" - ] + "isActive": { + "type": "boolean" }, "title": { "type": "string", @@ -13251,114 +11971,17 @@ } } }, - "request.ChatHistoryMessagesCreateRequest": { - "type": "object", - "required": [ - "content", - "message_type", - "session_id" - ], - "properties": { - "content": { - "type": "string" - }, - "message_type": { - "type": "string", - "enum": [ - "user", - "assistant" - ] - }, - "session_id": { - "type": "string" - } - } - }, - "request.ChatHistoryMessagesUpdateRequest": { - "type": "object", - "required": [ - "content" - ], - "properties": { - "content": { - "type": "string" - } - } - }, - "request.ChatHistorySessionsCreateRequest": { - "type": "object", - "required": [ - "agent_id", - "session_id", - "user_id" - ], - "properties": { - "agent_id": { - "type": "string" - }, - "messages": { - "type": "array", - "items": { - "$ref": "#/definitions/request.ChatMessageRequest" - } - }, - "session_id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "user_id": { - "type": "integer" - } - } - }, - "request.ChatHistorySessionsUpdateRequest": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "active", - "archived", - "deleted" - ] - }, - "title": { - "type": "string" - } - } - }, - "request.ChatMessageRequest": { - "type": "object", - "required": [ - "content", - "type" - ], - "properties": { - "content": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "user", - "assistant" - ] - } - } - }, "request.CitiesCreateRequest": { "type": "object", "required": [ - "city_name", - "prov_id" + "cityName", + "provId" ], "properties": { - "city_name": { + "cityName": { "type": "string" }, - "prov_id": { + "provId": { "type": "integer" } } @@ -13366,18 +11989,18 @@ "request.CitiesUpdateRequest": { "type": "object", "required": [ - "city_name", + "cityName", "id", - "prov_id" + "provId" ], "properties": { - "city_name": { + "cityName": { "type": "string" }, "id": { "type": "integer" }, - "prov_id": { + "provId": { "type": "integer" } } @@ -13428,7 +12051,7 @@ "title": { "type": "string" }, - "updated_at": { + "updatedAt": { "type": "string" } } @@ -13985,41 +12608,41 @@ "type": "object", "required": [ "id", - "is_admin_enabled", - "is_approval_enabled", - "is_delete_enabled", - "is_insert_enabled", - "is_update_enabled", - "is_view_enabled", - "menu_id", - "user_role_id" + "isAdminEnabled", + "isApprovalEnabled", + "isDeleteEnabled", + "isInsertEnabled", + "isUpdateEnabled", + "isViewEnabled", + "menuId", + "userRoleId" ], "properties": { "id": { "type": "integer" }, - "is_admin_enabled": { + "isAdminEnabled": { "type": "boolean" }, - "is_approval_enabled": { + "isApprovalEnabled": { "type": "boolean" }, - "is_delete_enabled": { + "isDeleteEnabled": { "type": "boolean" }, - "is_insert_enabled": { + "isInsertEnabled": { "type": "boolean" }, - "is_update_enabled": { + "isUpdateEnabled": { "type": "boolean" }, - "is_view_enabled": { + "isViewEnabled": { "type": "boolean" }, - "menu_id": { + "menuId": { "type": "integer" }, - "user_role_id": { + "userRoleId": { "type": "integer" } } @@ -14066,9 +12689,9 @@ "required": [ "code", "description", - "level_number", + "levelNumber", "name", - "status_id", + "statusId", "userLevelIds" ], "properties": { @@ -14078,13 +12701,13 @@ "description": { "type": "string" }, - "level_number": { + "levelNumber": { "type": "integer" }, "name": { "type": "string" }, - "status_id": { + "statusId": { "type": "integer" }, "userLevelIds": { diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index e11c1d0..088d788 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -29,7 +29,7 @@ definitions: - assistant type: string sessionId: - type: integer + type: string required: - content - messageType @@ -47,27 +47,26 @@ definitions: properties: agentId: type: string + sessionId: + type: string title: maxLength: 255 minLength: 2 type: string required: + - agentId + - sessionId - title type: object request.AIChatSessionsUpdateRequest: properties: - status: - enum: - - active - - archived - - deleted - type: string + isActive: + type: boolean title: maxLength: 255 minLength: 2 type: string required: - - status - title type: object request.ActivityLogsCreateRequest: @@ -368,94 +367,28 @@ definitions: - title - typeId type: object - request.ChatHistoryMessagesCreateRequest: - properties: - content: - type: string - message_type: - enum: - - user - - assistant - type: string - session_id: - type: string - required: - - content - - message_type - - session_id - type: object - request.ChatHistoryMessagesUpdateRequest: - properties: - content: - type: string - required: - - content - type: object - request.ChatHistorySessionsCreateRequest: - properties: - agent_id: - type: string - messages: - items: - $ref: '#/definitions/request.ChatMessageRequest' - type: array - session_id: - type: string - title: - type: string - user_id: - type: integer - required: - - agent_id - - session_id - - user_id - type: object - request.ChatHistorySessionsUpdateRequest: - properties: - status: - enum: - - active - - archived - - deleted - type: string - title: - type: string - type: object - request.ChatMessageRequest: - properties: - content: - type: string - type: - enum: - - user - - assistant - type: string - required: - - content - - type - type: object request.CitiesCreateRequest: properties: - city_name: + cityName: type: string - prov_id: + provId: type: integer required: - - city_name - - prov_id + - cityName + - provId type: object request.CitiesUpdateRequest: properties: - city_name: + cityName: type: string id: type: integer - prov_id: + provId: type: integer required: - - city_name + - cityName - id - - prov_id + - provId type: object request.CustomStaticPagesCreateRequest: properties: @@ -484,7 +417,7 @@ definitions: type: string title: type: string - updated_at: + updatedAt: type: string required: - htmlBody @@ -876,32 +809,32 @@ definitions: properties: id: type: integer - is_admin_enabled: + isAdminEnabled: type: boolean - is_approval_enabled: + isApprovalEnabled: type: boolean - is_delete_enabled: + isDeleteEnabled: type: boolean - is_insert_enabled: + isInsertEnabled: type: boolean - is_update_enabled: + isUpdateEnabled: type: boolean - is_view_enabled: + isViewEnabled: type: boolean - menu_id: + menuId: type: integer - user_role_id: + userRoleId: type: integer required: - id - - is_admin_enabled - - is_approval_enabled - - is_delete_enabled - - is_insert_enabled - - is_update_enabled - - is_view_enabled - - menu_id - - user_role_id + - isAdminEnabled + - isApprovalEnabled + - isDeleteEnabled + - isInsertEnabled + - isUpdateEnabled + - isViewEnabled + - menuId + - userRoleId type: object request.UserRolesCreateRequest: properties: @@ -935,11 +868,11 @@ definitions: type: string description: type: string - level_number: + levelNumber: type: integer name: type: string - status_id: + statusId: type: integer userLevelIds: items: @@ -948,9 +881,9 @@ definitions: required: - code - description - - level_number + - levelNumber - name - - status_id + - statusId - userLevelIds type: object request.UserSavePassword: @@ -1150,10 +1083,6 @@ paths: get: description: API for getting all ActivityLogs parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: activityTypeId type: integer @@ -1215,10 +1144,6 @@ paths: post: description: API for create ActivityLogs parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1261,10 +1186,6 @@ paths: delete: description: API for delete ActivityLogs parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1300,10 +1221,6 @@ paths: put: description: API for update ActivityLogs parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1346,10 +1263,6 @@ paths: get: description: API for getting one ActivityLogs parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ActivityLogs ID in: path name: id @@ -1380,11 +1293,6 @@ paths: /activity-logs/statistics: get: description: API for get activity stats ActivityLogs - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string responses: "200": description: OK @@ -1411,10 +1319,6 @@ paths: get: description: API for getting all Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: description type: string @@ -1482,10 +1386,6 @@ paths: post: description: API for create Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1528,10 +1428,6 @@ paths: delete: description: API for delete Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1567,10 +1463,6 @@ paths: get: description: API for getting one Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Advertisement ID in: path name: id @@ -1601,10 +1493,6 @@ paths: put: description: API for update Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1647,10 +1535,6 @@ paths: put: description: API for Update Publish Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1697,10 +1581,6 @@ paths: post: description: API for Upload File Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1744,10 +1624,6 @@ paths: get: description: API for Viewer Advertisement parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Content File Name in: path name: filename @@ -1779,9 +1655,10 @@ paths: get: description: API for getting all AI chat logs for authenticated user parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - in: query name: logType @@ -1836,9 +1713,10 @@ paths: get: description: API for getting one AI chat log parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Log ID in: path @@ -1871,13 +1749,14 @@ paths: get: description: API for getting all AI chat sessions for authenticated user parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - in: query - name: status - type: string + name: isActive + type: boolean - in: query name: count type: integer @@ -1927,10 +1806,6 @@ paths: post: description: API for create AI chat session parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -1973,9 +1848,10 @@ paths: delete: description: API for delete AI chat session parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Insert the X-Csrf-Token in: header @@ -2012,9 +1888,10 @@ paths: get: description: API for getting one AI chat session parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Session ID in: path @@ -2046,9 +1923,10 @@ paths: put: description: API for update AI chat session parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Insert the X-Csrf-Token in: header @@ -2092,9 +1970,10 @@ paths: get: description: API for getting all messages in an AI chat session parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Session ID in: path @@ -2104,7 +1983,7 @@ paths: - in: query name: sessionId required: true - type: integer + type: string - in: query name: count type: integer @@ -2151,23 +2030,20 @@ paths: summary: Get AI chat session messages tags: - AI Chat + /ai-chat/sessions/messages: post: description: API for sending a message to an AI chat session parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token required: true type: string - - description: Session ID - in: path - name: sessionId - required: true - type: integer - description: Required payload in: body name: payload @@ -2196,24 +2072,20 @@ paths: summary: Send message to AI chat session tags: - AI Chat - /ai-chat/sessions/{sessionId}/messages/{messageId}: + /ai-chat/sessions/messages/{messageId}: delete: description: API for delete AI chat message parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token required: true type: string - - description: Session ID - in: path - name: sessionId - required: true - type: integer - description: Message ID in: path name: messageId @@ -2244,20 +2116,16 @@ paths: put: description: API for update AI chat message parameters: - - description: Insert the X-Client-Key + - default: Bearer + description: Insert your access token in: header - name: X-Client-Key + name: Authorization type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token required: true type: string - - description: Session ID - in: path - name: sessionId - required: true - type: integer - description: Message ID in: path name: messageId @@ -2359,10 +2227,6 @@ paths: post: description: API for create ArticleApprovals parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -2512,10 +2376,6 @@ paths: get: description: API for getting all ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - default: Bearer description: Insert your access token in: header @@ -2591,10 +2451,6 @@ paths: post: description: API for create ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -2637,10 +2493,6 @@ paths: delete: description: API for delete ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -2676,10 +2528,6 @@ paths: get: description: API for getting one ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ArticleCategories ID in: path name: id @@ -2710,10 +2558,6 @@ paths: put: description: API for update ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -2756,10 +2600,6 @@ paths: get: description: API for getting one ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ArticleCategories Old ID in: path name: id @@ -2791,10 +2631,6 @@ paths: get: description: API for getting one ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ArticleCategories Slug in: path name: slug @@ -2826,10 +2662,6 @@ paths: post: description: API for Upload ArticleCategories Thumbnail parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -2873,10 +2705,6 @@ paths: get: description: API for View Thumbnail of ArticleCategories parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ArticleCategories ID in: path name: id @@ -3084,10 +2912,6 @@ paths: get: description: API for getting all ArticleComments parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: articleId type: integer @@ -3152,10 +2976,6 @@ paths: post: description: API for create ArticleComments parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3198,10 +3018,6 @@ paths: delete: description: API for delete ArticleComments parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3237,10 +3053,6 @@ paths: get: description: API for getting one ArticleComments parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ArticleComments ID in: path name: id @@ -3271,10 +3083,6 @@ paths: put: description: API for update ArticleComments parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3317,10 +3125,6 @@ paths: post: description: API for Approval ArticleComments parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3358,10 +3162,6 @@ paths: get: description: API for getting all ArticleFiles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: articleId type: integer @@ -3424,10 +3224,6 @@ paths: post: description: API for create ArticleFiles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3471,10 +3267,6 @@ paths: delete: description: API for delete ArticleFiles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3510,10 +3302,6 @@ paths: get: description: API for getting one ArticleFiles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: ArticleFiles ID in: path name: id @@ -3544,10 +3332,6 @@ paths: put: description: API for update ArticleFiles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -3621,10 +3405,6 @@ paths: get: description: API for Viewer ArticleFiles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Article File Name in: path name: filename @@ -3743,10 +3523,6 @@ paths: post: description: API for create Articles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -4116,10 +3892,6 @@ paths: post: description: API for Save Thumbnail of Articles parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -4190,472 +3962,6 @@ paths: summary: Viewer Articles Thumbnail tags: - Articles - /chat-history/messages/{messageId}: - delete: - description: API for delete chat history message - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - description: Message ID - in: path - name: messageId - required: true - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Delete chat history message - tags: - - Chat History - put: - description: API for update chat history message - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - description: Message ID - in: path - name: messageId - required: true - type: integer - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.ChatHistoryMessagesUpdateRequest' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Update chat history message - tags: - - Chat History - /chat-history/save: - post: - description: API for saving complete chat history including sessions and messages - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - default: Bearer - description: Insert your access token - in: header - name: Authorization - type: string - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.ChatHistorySessionsCreateRequest' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Save chat history (sessions and messages) - tags: - - Chat History - /chat-history/sessions: - get: - description: API for getting all chat history sessions for authenticated user - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - in: query - name: agent_id - type: string - - in: query - name: session_id - type: string - - in: query - name: user_id - type: integer - - in: query - name: count - type: integer - - in: query - name: limit - type: integer - - in: query - name: nextPage - type: integer - - in: query - name: page - type: integer - - in: query - name: previousPage - type: integer - - in: query - name: sort - type: string - - in: query - name: sortBy - type: string - - in: query - name: totalPage - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Get user chat history sessions - tags: - - Chat History - post: - description: API for create chat history session - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - default: Bearer - description: Insert your access token - in: header - name: Authorization - type: string - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.ChatHistorySessionsCreateRequest' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Create chat history session - tags: - - Chat History - /chat-history/sessions/{sessionId}: - delete: - description: API for delete chat history session - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - description: Session ID - in: path - name: sessionId - required: true - type: string - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Delete chat history session - tags: - - Chat History - get: - description: API for getting one chat history session with all its messages - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Session ID - in: path - name: sessionId - required: true - type: string - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Get one chat history session with messages - tags: - - Chat History - put: - description: API for update chat history session - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - description: Session ID - in: path - name: sessionId - required: true - type: string - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.ChatHistorySessionsUpdateRequest' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Update chat history session - tags: - - Chat History - /chat-history/sessions/{sessionId}/messages: - get: - description: API for getting all messages in a chat history session - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Session ID - in: path - name: sessionId - required: true - type: string - - in: query - name: session_id - required: true - type: string - - in: query - name: count - type: integer - - in: query - name: limit - type: integer - - in: query - name: nextPage - type: integer - - in: query - name: page - type: integer - - in: query - name: previousPage - type: integer - - in: query - name: sort - type: string - - in: query - name: sortBy - type: string - - in: query - name: totalPage - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Get chat history session messages - tags: - - Chat History - post: - description: API for creating a message in a chat history session - parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - - description: Insert the X-Csrf-Token - in: header - name: X-Csrf-Token - required: true - type: string - - description: Session ID - in: path - name: sessionId - required: true - type: string - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.ChatHistoryMessagesCreateRequest' - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' - security: - - Bearer: [] - summary: Create chat history message - tags: - - Chat History /cities: get: description: API for getting all Cities @@ -4837,10 +4143,6 @@ paths: get: description: API for getting all CustomStaticPages parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: description type: string @@ -4902,10 +4204,6 @@ paths: post: description: API for create CustomStaticPages parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -4943,10 +4241,6 @@ paths: delete: description: API for delete CustomStaticPages parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -4982,10 +4276,6 @@ paths: get: description: API for getting one CustomStaticPages parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: CustomStaticPages ID in: path name: id @@ -5016,10 +4306,6 @@ paths: put: description: API for update CustomStaticPages parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5062,10 +4348,6 @@ paths: get: description: API for getting one CustomStaticPages parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: CustomStaticPages Slug in: path name: slug @@ -5257,10 +4539,6 @@ paths: get: description: API for getting all Education History for authenticated user parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: educationLevel type: string @@ -5322,10 +4600,6 @@ paths: post: description: API for create Education History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5368,10 +4642,6 @@ paths: delete: description: API for delete Education History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5407,10 +4677,6 @@ paths: get: description: API for getting one Education History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Education History ID in: path name: id @@ -5441,10 +4707,6 @@ paths: put: description: API for update Education History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5487,10 +4749,6 @@ paths: post: description: API for upload certificate image for Education History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5532,10 +4790,6 @@ paths: get: description: API for getting all Feedbacks parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: commentFromEmail type: string @@ -5603,10 +4857,6 @@ paths: post: description: API for create Feedbacks parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5649,10 +4899,6 @@ paths: delete: description: API for delete Feedbacks parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5688,10 +4934,6 @@ paths: get: description: API for getting one Feedbacks parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Feedbacks ID in: path name: id @@ -5722,10 +4964,6 @@ paths: put: description: API for update Feedbacks parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -5768,10 +5006,6 @@ paths: get: description: API for FeedbackMonthlyStats of Feedbacks parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - default: Bearer description: Insert your access token in: header @@ -6015,10 +5249,6 @@ paths: get: description: API for getting all Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: createdById type: integer @@ -6092,10 +5322,6 @@ paths: post: description: API for create Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -6138,10 +5364,6 @@ paths: delete: description: API for delete Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -6177,10 +5399,6 @@ paths: get: description: API for getting one Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Magazines ID in: path name: id @@ -6211,10 +5429,6 @@ paths: put: description: API for update Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -6257,10 +5471,6 @@ paths: post: description: API for Save Thumbnail of Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -6304,10 +5514,6 @@ paths: get: description: API for View Thumbnail of Magazines parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Magazines Thumbnail Name in: path name: thumbnailName @@ -7067,10 +6273,6 @@ paths: get: description: API for getting all Research Journals for authenticated user parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: journalTitle type: string @@ -7129,10 +6331,6 @@ paths: post: description: API for create Research Journal parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -7175,10 +6373,6 @@ paths: delete: description: API for delete Research Journal parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -7214,10 +6408,6 @@ paths: get: description: API for getting one Research Journal parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Research Journal ID in: path name: id @@ -7248,10 +6438,6 @@ paths: put: description: API for update Research Journal parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -7294,10 +6480,6 @@ paths: get: description: API for getting all Subscription parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: email type: string @@ -7350,10 +6532,6 @@ paths: post: description: API for create Subscription parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -7391,10 +6569,6 @@ paths: delete: description: API for delete Subscription parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -7430,10 +6604,6 @@ paths: get: description: API for getting one Subscription parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Subscription ID in: path name: id @@ -7464,10 +6634,6 @@ paths: put: description: API for update Subscription parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8346,10 +7512,6 @@ paths: get: description: API for getting all Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: email type: string @@ -8435,10 +7597,6 @@ paths: post: description: API for create Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8481,10 +7639,6 @@ paths: delete: description: API for delete Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8520,10 +7674,6 @@ paths: put: description: API for update Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8566,10 +7716,6 @@ paths: get: description: API for getting one Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Users ID in: path name: id @@ -8601,10 +7747,6 @@ paths: post: description: API for Email Validation Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8642,10 +7784,6 @@ paths: post: description: API for ForgotPassword Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8683,10 +7821,6 @@ paths: get: description: API for ShowUserInfo parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - default: Bearer description: Insert your access token in: header @@ -8903,10 +8037,6 @@ paths: post: description: API for SavePassword Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8949,10 +8079,6 @@ paths: post: description: API for Setup Email Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -8990,10 +8116,6 @@ paths: get: description: API for getting one Users parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Username in: path name: username @@ -9025,10 +8147,6 @@ paths: get: description: API for getting all Work History for authenticated user parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - in: query name: companyName type: string @@ -9088,10 +8206,6 @@ paths: post: description: API for create Work History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -9134,10 +8248,6 @@ paths: delete: description: API for delete Work History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token @@ -9173,10 +8283,6 @@ paths: get: description: API for getting one Work History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Work History ID in: path name: id @@ -9207,10 +8313,6 @@ paths: put: description: API for update Work History parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - type: string - description: Insert the X-Csrf-Token in: header name: X-Csrf-Token diff --git a/main.go b/main.go index a4a9e5a..41f89f5 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,6 @@ import ( "narasi-ahli-be/app/module/article_comments" "narasi-ahli-be/app/module/article_files" "narasi-ahli-be/app/module/articles" - "narasi-ahli-be/app/module/chat_history" "narasi-ahli-be/app/module/cities" "narasi-ahli-be/app/module/custom_static_pages" "narasi-ahli-be/app/module/districts" @@ -74,7 +73,6 @@ func main() { article_approvals.NewArticleApprovalsModule, articles.NewArticlesModule, article_comments.NewArticleCommentsModule, - chat_history.NewChatHistoryModule, cities.NewCitiesModule, custom_static_pages.NewCustomStaticPagesModule, districts.NewDistrictsModule, diff --git a/plan/code-templates.md b/plan/code-templates.md index 2df25ca..2b8a21c 100644 --- a/plan/code-templates.md +++ b/plan/code-templates.md @@ -120,7 +120,6 @@ func NewEducationHistoryController(educationHistoryService service.EducationHist // @Description API for getting all Education History for authenticated user // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param req query request.EducationHistoryQueryRequest false "query parameters" // @Param req query paginator.Pagination false "pagination parameters" // @Success 200 {object} response.Response @@ -173,7 +172,6 @@ func (_i *educationHistoryController) All(c *fiber.Ctx) error { // @Description API for getting one Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param id path int true "Education History ID" // @Success 200 {object} response.Response // @Failure 400 {object} response.BadRequestError @@ -214,7 +212,6 @@ func (_i *educationHistoryController) Show(c *fiber.Ctx) error { // @Description API for create Education History // @Tags Education History // @Security Bearer -// @Param X-Client-Key header string false "Insert the X-Client-Key" // @Param X-Csrf-Token header string true "Insert the X-Csrf-Token" // @Param Authorization header string false "Insert your access token" default(Bearer ) // @Param payload body request.EducationHistoryCreateRequest true "Required payload" diff --git a/scripts/migrate.go b/scripts/migrate.go deleted file mode 100644 index c1e529e..0000000 --- a/scripts/migrate.go +++ /dev/null @@ -1,38 +0,0 @@ -package main - -import ( - "narasi-ahli-be/app/database" - "narasi-ahli-be/app/database/entity" - "narasi-ahli-be/migrations" - - "github.com/rs/zerolog" - "go.uber.org/fx" -) - -func main() { - fx.New( - fx.Provide(database.NewDatabase), - fx.Provide(func() zerolog.Logger { - return zerolog.Nop() - }), - fx.Invoke(func(db *database.Database) { - // Run migration - err := migrations.CreateChatHistoryTables(db) - if err != nil { - panic(err) - } - - // Also auto-migrate existing entities - err = db.DB.AutoMigrate( - &entity.AIChatSessions{}, - &entity.AIChatMessages{}, - &entity.AIChatLogs{}, - ) - if err != nil { - panic(err) - } - - println("Migration completed successfully!") - }), - ).Run() -}