diff --git a/go-server/docs/docs.go b/go-server/docs/docs.go index 6433683..b485943 100644 --- a/go-server/docs/docs.go +++ b/go-server/docs/docs.go @@ -65,22 +65,22 @@ const docTemplate = `{ "$ref": "#/definitions/models.YoutubeAnalyzerRespBody" } }, - "204": { - "description": "No Content", + "400": { + "description": "Bad Request", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, "500": { "description": "Internal Server Error", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } } } @@ -111,22 +111,22 @@ const docTemplate = `{ "$ref": "#/definitions/models.YoutubeAnalyzerLandingRespBody" } }, - "204": { - "description": "No Content", + "400": { + "description": "Bad Request", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, "500": { "description": "Internal Server Error", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } } } @@ -1615,15 +1615,6 @@ const docTemplate = `{ } } }, - "utils.HandleError.errorResponse": { - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "an error ocurred" - } - } - }, "youtube.Comment": { "type": "object", "properties": { diff --git a/go-server/docs/swagger.json b/go-server/docs/swagger.json index 5f93658..2824b11 100644 --- a/go-server/docs/swagger.json +++ b/go-server/docs/swagger.json @@ -58,22 +58,22 @@ "$ref": "#/definitions/models.YoutubeAnalyzerRespBody" } }, - "204": { - "description": "No Content", + "400": { + "description": "Bad Request", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, "500": { "description": "Internal Server Error", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } } } @@ -104,22 +104,22 @@ "$ref": "#/definitions/models.YoutubeAnalyzerLandingRespBody" } }, - "204": { - "description": "No Content", + "400": { + "description": "Bad Request", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, - "400": { - "description": "Bad Request", + "404": { + "description": "Not Found", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } }, "500": { "description": "Internal Server Error", "schema": { - "$ref": "#/definitions/utils.HandleError.errorResponse" + "$ref": "#/definitions/fiber.Error" } } } @@ -1608,15 +1608,6 @@ } } }, - "utils.HandleError.errorResponse": { - "type": "object", - "properties": { - "error": { - "type": "string", - "example": "an error ocurred" - } - } - }, "youtube.Comment": { "type": "object", "properties": { diff --git a/go-server/docs/swagger.yaml b/go-server/docs/swagger.yaml index 70d6cbb..071296a 100644 --- a/go-server/docs/swagger.yaml +++ b/go-server/docs/swagger.yaml @@ -653,12 +653,6 @@ definitions: $ref: '#/definitions/models.YoutubeVideoDashboard' type: array type: object - utils.HandleError.errorResponse: - properties: - error: - example: an error ocurred - type: string - type: object youtube.Comment: properties: etag: @@ -949,18 +943,18 @@ paths: description: OK schema: $ref: '#/definitions/models.YoutubeAnalyzerRespBody' - "204": - description: No Content - schema: - $ref: '#/definitions/utils.HandleError.errorResponse' "400": description: Bad Request schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' + "404": + description: Not Found + schema: + $ref: '#/definitions/fiber.Error' "500": description: Internal Server Error schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' summary: Performs the analysis of the youtube video /api/youtube/analysis-landing: post: @@ -980,18 +974,18 @@ paths: description: OK schema: $ref: '#/definitions/models.YoutubeAnalyzerLandingRespBody' - "204": - description: No Content - schema: - $ref: '#/definitions/utils.HandleError.errorResponse' "400": description: Bad Request schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' + "404": + description: Not Found + schema: + $ref: '#/definitions/fiber.Error' "500": description: Internal Server Error schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' summary: Simple analysis with BERT model for the landing page /api/youtube/pre-analysis: post: diff --git a/go-server/handlers/billing.go b/go-server/handlers/billing.go index 8b5878c..6dfc6da 100644 --- a/go-server/handlers/billing.go +++ b/go-server/handlers/billing.go @@ -8,7 +8,6 @@ import ( "gptube/database" "gptube/models" "gptube/services" - "gptube/utils" "log" "math" "net/http" @@ -351,7 +350,7 @@ func BillingSubscriptionsWebhooks(c *fiber.Ctx) error { prettyJSON, err := json.MarshalIndent(webhookBody, "", " ") if err != nil { - return utils.HandleError(err, http.StatusInternalServerError, c) + return fiber.NewError(http.StatusInternalServerError, err.Error()) } eventHandlers := make(map[string]func( diff --git a/go-server/handlers/youtube.go b/go-server/handlers/youtube.go index 01b6a70..5326085 100644 --- a/go-server/handlers/youtube.go +++ b/go-server/handlers/youtube.go @@ -1,13 +1,11 @@ package handlers import ( - "errors" "fmt" "gptube/config" "gptube/database" "gptube/models" "gptube/services" - "gptube/utils" "log" "math" "net/http" @@ -186,36 +184,33 @@ func YoutubePreAnalysisHandler(c *fiber.Ctx) error { // @Produce json // @Param video body models.YoutubeAnalyzerReqBody true "Youtube video analysis request body" // @Success 200 {object} models.YoutubeAnalyzerRespBody -// @Failure 204 {object} utils.HandleError.errorResponse -// @Failure 400 {object} utils.HandleError.errorResponse -// @Failure 500 {object} utils.HandleError.errorResponse +// @Failure 400 {object} fiber.Error +// @Failure 404 {object} fiber.Error +// @Failure 500 {object} fiber.Error // @Router /api/youtube/analysis [post] func YoutubeAnalysisHandler(c *fiber.Ctx) error { var body models.YoutubeAnalyzerReqBody if err := c.BodyParser(&body); err != nil { - return utils.HandleError(err, http.StatusInternalServerError, c) + return fiber.NewError(http.StatusInternalServerError, "problem while parsing your request") } if body.VideoId == "" { - err := fmt.Errorf("you must provide the youtube video id") - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, "you must provide the youtube video id") } if body.UserId == "" { - err := fmt.Errorf("you must provide your user id") - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, "you must provide your user id") } videoData, err := services.GetVideoData(body.VideoId) if err != nil { if err.Error() == "video not found" { - err = fmt.Errorf("video analysis failed ๐Ÿ˜ฟ, video not found please provide a valid video id") - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, "video analysis failed ๐Ÿ˜ฟ, video not found please provide a valid video id") } err = fmt.Errorf("video analysis for %q failed ๐Ÿ˜ฟ, try again later or contact us", videoData.Items[0].Snippet.Title) - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, err.Error()) } // This means we havenยดt received email hence is a short video so we do @@ -228,12 +223,10 @@ func YoutubeAnalysisHandler(c *fiber.Ctx) error { if err != nil { err = fmt.Errorf("video analysis for %q failed ๐Ÿ˜ฟ, try again later or contact us", videoData.Items[0].Snippet.Title) - return utils.HandleError(err, http.StatusInternalServerError, c) + return fiber.NewError(http.StatusInternalServerError, err.Error()) } if analysis.Results.BertResults.SuccessCount == 0 && analysis.Results.RobertaResults.SuccessCount == 0 { - err = fmt.Errorf("video analysis for %q failed ๐Ÿ˜ฟ, couldn't analyze any comment", - videoData.Items[0].Snippet.Title) log.Printf("[YoutubeAnalysisHandler] Couldn't analyze any comment for a model\n") log.Printf("[YoutubeAnalysisHandler] Number of comments success Bert: %d\n", analysis.Results.BertResults.SuccessCount) @@ -243,7 +236,7 @@ func YoutubeAnalysisHandler(c *fiber.Ctx) error { analysis.Results.RobertaResults.SuccessCount) log.Printf("[YoutubeAnalysisHandler] Number of comments failed Roberta: %d\n", analysis.Results.RobertaResults.ErrorsCount) - return utils.HandleError(err, http.StatusNoContent, c) + return fiber.NewError(http.StatusNotFound, "We didn't found any negative comment.") } // sending the results to the user @@ -258,8 +251,7 @@ func YoutubeAnalysisHandler(c *fiber.Ctx) error { // Sending the e-mail error to the user log.Printf("[YoutubeAnalysisHandler] Error saving data to firebase: %v\n", err.Error()) - return utils.HandleError(errors.New("error while saving analysis results"), - http.StatusInternalServerError, c) + return fiber.NewError(http.StatusInternalServerError, "error while doing the analysis") } //////////////////////////////////////////////// @@ -357,32 +349,29 @@ func YoutubeAnalysisHandler(c *fiber.Ctx) error { // @Produce json // @Param video body models.YoutubeAnalyzerLandingReqBody true "Youtube video id" // @Success 200 {object} models.YoutubeAnalyzerLandingRespBody -// @Failure 204 {object} utils.HandleError.errorResponse -// @Failure 400 {object} utils.HandleError.errorResponse -// @Failure 500 {object} utils.HandleError.errorResponse +// @Failure 400 {object} fiber.Error +// @Failure 404 {object} fiber.Error +// @Failure 500 {object} fiber.Error // @Router /api/youtube/analysis-landing [post] func YoutubeAnalysisLandingHandler(c *fiber.Ctx) error { var body models.YoutubeAnalyzerLandingReqBody if err := c.BodyParser(&body); err != nil { - err := fmt.Errorf("video analysis failed ๐Ÿ˜ฟ, incorrect body encoding") - return utils.HandleError(err, http.StatusInternalServerError, c) + return fiber.NewError(http.StatusInternalServerError, "video analysis failed ๐Ÿ˜ฟ, incorrect body encoding") } if body.VideoID == "" { - err := fmt.Errorf("video analysis failed ๐Ÿ˜ฟ, please provide a video id") - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, "video analysis failed ๐Ÿ˜ฟ, please provide a video id") } videoData, err := services.GetVideoData(body.VideoID) if err != nil { if err.Error() == "video not found" { - err = fmt.Errorf("video analysis failed ๐Ÿ˜ฟ, video not found please provide a valid video id") - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, "video analysis failed ๐Ÿ˜ฟ, video not found please provide a valid video id") } err = fmt.Errorf("video analysis for %q failed ๐Ÿ˜ฟ, try again later or contact us", videoData.Items[0].Snippet.Title) - return utils.HandleError(err, http.StatusBadRequest, c) + return fiber.NewError(http.StatusBadRequest, err.Error()) } // This means we havenยดt received email hence is a short video so we do @@ -391,13 +380,13 @@ func YoutubeAnalysisLandingHandler(c *fiber.Ctx) error { if err != nil { err = fmt.Errorf("video analysis for %q failed ๐Ÿ˜ฟ, try again later or contact us", videoData.Items[0].Snippet.Title) - return utils.HandleError(err, http.StatusInternalServerError, c) + return fiber.NewError(http.StatusInternalServerError, err.Error()) } if results.BertResults.SuccessCount == 0 { - noContentError := fmt.Errorf("video analysis for %q failed ๐Ÿ˜ฟ, we couldn't analyze any comment", + noContentError := fmt.Errorf("we didn't found any negative comment for video: %q", videoData.Items[0].Snippet.Title) - return utils.HandleError(noContentError, http.StatusNoContent, c) + return fiber.NewError(http.StatusNotFound, noContentError.Error()) } // sending the results to the user diff --git a/gptube/app/dashboard/layout.tsx b/gptube/app/dashboard/layout.tsx index 15a4a28..33f54f2 100644 --- a/gptube/app/dashboard/layout.tsx +++ b/gptube/app/dashboard/layout.tsx @@ -1,7 +1,12 @@ -'use client' +import type { Metadata } from 'next' + import { DashboardNavigation } from '@/components/dashboard/navigation' import { Header } from '@/components/header' +export const metadata: Metadata = { + title: 'GPTube Dashboard', +} + export default function DashboardLayout({ children }: { children: React.ReactNode }) { return ( <> diff --git a/gptube/app/dashboard/page.tsx b/gptube/app/dashboard/page.tsx index 38bca88..040f702 100644 --- a/gptube/app/dashboard/page.tsx +++ b/gptube/app/dashboard/page.tsx @@ -39,7 +39,7 @@ export default function Dashboard() { {isLoadingVideos || isFetching ? (
- +
) : (
@@ -47,7 +47,9 @@ export default function Dashboard() { Total videos analyzed are {count || 0}

- {!videos || videos.length === 0 ? : null} + {!videos || videos.length === 0 ? ( + + ) : null}
{videos?.map(video => )}
diff --git a/gptube/app/dashboard/videos/[videoId]/negative-comments/page.tsx b/gptube/app/dashboard/videos/[videoId]/negative-comments/page.tsx index 514a366..c6449b8 100644 --- a/gptube/app/dashboard/videos/[videoId]/negative-comments/page.tsx +++ b/gptube/app/dashboard/videos/[videoId]/negative-comments/page.tsx @@ -1,7 +1,5 @@ 'use client' -import { useParams } from 'next/navigation' - import { DEFAULT_PAGE_PAGINATION, DEFAULT_PAGE_SIZE_PAGINATION, @@ -11,8 +9,8 @@ import { NegativeCommentsTopActions } from '@/components/videos/negative-comment import { NegativeComments } from '@/components/videos/negative-comments/NegativeComments' // TODO: Set this page as protected route for new users -function Video() { - const { videoId } = useParams<{ videoId: string }>()! +function NegativeCommentsPage({ params }: { params: { videoId: string } }) { + const { videoId } = params const { commentsPage, isLoading: isLoadingComments, @@ -47,4 +45,4 @@ function Video() { ) } -export default Video +export default NegativeCommentsPage diff --git a/gptube/app/dashboard/videos/[videoId]/page.tsx b/gptube/app/dashboard/videos/[videoId]/page.tsx index 0df9a06..a25394e 100644 --- a/gptube/app/dashboard/videos/[videoId]/page.tsx +++ b/gptube/app/dashboard/videos/[videoId]/page.tsx @@ -1,28 +1,38 @@ 'use client' -import { useParams } from 'next/navigation' +import { Spinner } from '@nextui-org/react' import { useVideoStats } from '@/hooks/use-video-stats' import { VideoTopActions } from '@/components/videos/VideoTopActions' import { MainStatistics } from '@/components/videos/MainStatistics' +import { NotVideoFound } from '@/components/dashboard/not-videos-found' // TODO: Set this page as protected route for new users -function Video() { - const { videoId } = useParams<{ videoId: string }>()! +function VideoPage({ params }: { params: { videoId: string } }) { + const { videoId } = params const { videoData, isLoading } = useVideoStats(videoId) + if (isLoading) { + return ( +
+ +
+ ) + } + + if (!videoData) return + return ( <> - + ) } -export default Video +export default VideoPage diff --git a/gptube/app/layout.tsx b/gptube/app/layout.tsx index 2f92c92..a37a592 100644 --- a/gptube/app/layout.tsx +++ b/gptube/app/layout.tsx @@ -7,8 +7,13 @@ import { Providers } from './providers' import '../styles/globals.css' export const metadata: Metadata = { - title: 'GPTube', - description: 'Welcome to a AI powered YouTube video analysis tool', + title: { + template: '%s | GPTube', + default: 'GPTube', + }, + description: + 'The official platform of GPTube, the most powerful sentiment analysis tool for youtube.', + metadataBase: new URL('https://www.gptube.ink/'), } export default function RootLayout({ children }: { children: React.ReactNode }) { diff --git a/gptube/app/page.tsx b/gptube/app/page.tsx index 6721d10..8eb27f8 100644 --- a/gptube/app/page.tsx +++ b/gptube/app/page.tsx @@ -1,9 +1,13 @@ -'use client' +import type { Metadata } from 'next' import { Footer } from '@/components/footer' import { Header } from '@/components/header' import { LandingUI } from '@/components/landing/landing-ui' +export const metadata: Metadata = { + title: 'GPTube Landing', +} + // TODO: Set this page as the default landing page, the Dashboard component should be in the "/dashboard" route export default function Home() { return ( diff --git a/gptube/components/dashboard/navigation.tsx b/gptube/components/dashboard/navigation.tsx index a9e50bc..2c6b3e6 100644 --- a/gptube/components/dashboard/navigation.tsx +++ b/gptube/components/dashboard/navigation.tsx @@ -1,3 +1,4 @@ +'use client' import { usePathname } from 'next/navigation' import Link from 'next/link' import { Breadcrumbs, BreadcrumbItem } from '@nextui-org/react' diff --git a/gptube/components/dashboard/not-videos-found.tsx b/gptube/components/dashboard/not-videos-found.tsx index 675cad6..9e99690 100644 --- a/gptube/components/dashboard/not-videos-found.tsx +++ b/gptube/components/dashboard/not-videos-found.tsx @@ -1,9 +1,9 @@ import { ButtonNewAnalysis } from './button-new-analysis' -export function NotVideoFound() { +export function NotVideoFound({ label }: { label: string }) { return (
- No videos found + {label} {/* eslint-disable-next-line @next/next/no-img-element */} No videos yetLoading stats...

- } - +export function MainStatistics({ results }: ModelsYoutubeVideoAnalyzed) { return ( <>
diff --git a/gptube/components/videos/RobertaStats.tsx b/gptube/components/videos/RobertaStats.tsx index 9e701c6..30c2b82 100644 --- a/gptube/components/videos/RobertaStats.tsx +++ b/gptube/components/videos/RobertaStats.tsx @@ -18,7 +18,7 @@ export default function RobertaStats({ results }: ModelsYoutubeVideoAnalyzed) { percentageFormatted: Math.round(100 * (results?.robertaResults?.negative || 0)), percentage: results?.robertaResults?.negative || 0, status: ModelScores.NEGATIVE, - color: '#f5a524', + color: '#f31260', name: 'negative ๐Ÿ˜ ', }, { diff --git a/gptube/components/videos/VideoTopActions.tsx b/gptube/components/videos/VideoTopActions.tsx index 27969e0..eb78b98 100644 --- a/gptube/components/videos/VideoTopActions.tsx +++ b/gptube/components/videos/VideoTopActions.tsx @@ -3,7 +3,6 @@ import type { ModelsYoutubeVideoAnalyzed } from '@/gptube-api' import Link from 'next/link' import { Youtube, RefreshCcw } from 'lucide-react' -import { Skeleton } from '@nextui-org/react' import { formatDateRelative, formatDate } from '@/utils/date.utils' import { useVideoAnalysis } from '@/hooks/use-video-analysis' @@ -11,76 +10,56 @@ import { useAuth } from '@/hooks/use-auth' import { Button } from '../Common/button' -interface VideoTopActionsProps extends ModelsYoutubeVideoAnalyzed { - isLoading: boolean -} - export function VideoTopActions({ snippet, createdAt, lastUpdate, videoId, - isLoading, -}: VideoTopActionsProps) { +}: ModelsYoutubeVideoAnalyzed) { const { user } = useAuth() const { handleAnalysis } = useVideoAnalysis() return (
- {isLoading ? ( -
- - - -
- ) : ( - <> - - - {snippet?.title} - -

- Created at:{' '} - - {formatDateRelative(createdAt)} - -

-

- Last update:{' '} - - {formatDateRelative(lastUpdate)} - -

- - )} + + + {snippet?.title} + +

+ Created at:{' '} + + {formatDateRelative(createdAt)} + +

+

+ Last update:{' '} + + {formatDateRelative(lastUpdate)} + +

- {!isLoading && ( -
- + + - - - -
- )} + +
) } diff --git a/gptube/gptube-api/generated-api/.openapi-generator/FILES b/gptube/gptube-api/generated-api/.openapi-generator/FILES index 011c5b1..96f4368 100644 --- a/gptube/gptube-api/generated-api/.openapi-generator/FILES +++ b/gptube/gptube-api/generated-api/.openapi-generator/FILES @@ -48,7 +48,6 @@ models/ModelsYoutubeVideoAnalyzed.ts models/ModelsYoutubeVideoDashboard.ts models/ModelsYoutubeVideoNegativeCommentsRespBody.ts models/ModelsYoutubeVideosRespBody.ts -models/UtilsHandleErrorErrorResponse.ts models/YoutubeComment.ts models/YoutubeCommentSnippet.ts models/YoutubeCommentSnippetAuthorChannelId.ts diff --git a/gptube/gptube-api/generated-api/apis/DefaultApi.ts b/gptube/gptube-api/generated-api/apis/DefaultApi.ts index f64abe5..7fb4ed1 100644 --- a/gptube/gptube-api/generated-api/apis/DefaultApi.ts +++ b/gptube/gptube-api/generated-api/apis/DefaultApi.ts @@ -31,7 +31,6 @@ import type { ModelsYoutubeVideoAnalyzed, ModelsYoutubeVideoNegativeCommentsRespBody, ModelsYoutubeVideosRespBody, - UtilsHandleErrorErrorResponse, } from '../models/index'; import { FiberErrorFromJSON, @@ -66,8 +65,6 @@ import { ModelsYoutubeVideoNegativeCommentsRespBodyToJSON, ModelsYoutubeVideosRespBodyFromJSON, ModelsYoutubeVideosRespBodyToJSON, - UtilsHandleErrorErrorResponseFromJSON, - UtilsHandleErrorErrorResponseToJSON, } from '../models/index'; export interface ApiYoutubeAnalysisLandingPostRequest { diff --git a/gptube/gptube-api/generated-api/models/UtilsHandleErrorErrorResponse.ts b/gptube/gptube-api/generated-api/models/UtilsHandleErrorErrorResponse.ts deleted file mode 100644 index fcd0e39..0000000 --- a/gptube/gptube-api/generated-api/models/UtilsHandleErrorErrorResponse.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * GPTube API swagger docs - * This is the API documentation of GPTube - * - * The version of the OpenAPI document: 1.0 - * Contact: luckly083@gmail.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface UtilsHandleErrorErrorResponse - */ -export interface UtilsHandleErrorErrorResponse { - /** - * - * @type {string} - * @memberof UtilsHandleErrorErrorResponse - */ - error?: string; -} - -/** - * Check if a given object implements the UtilsHandleErrorErrorResponse interface. - */ -export function instanceOfUtilsHandleErrorErrorResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function UtilsHandleErrorErrorResponseFromJSON(json: any): UtilsHandleErrorErrorResponse { - return UtilsHandleErrorErrorResponseFromJSONTyped(json, false); -} - -export function UtilsHandleErrorErrorResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): UtilsHandleErrorErrorResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'error': !exists(json, 'error') ? undefined : json['error'], - }; -} - -export function UtilsHandleErrorErrorResponseToJSON(value?: UtilsHandleErrorErrorResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'error': value.error, - }; -} - diff --git a/gptube/gptube-api/generated-api/models/index.ts b/gptube/gptube-api/generated-api/models/index.ts index b7590f7..4e5356b 100644 --- a/gptube/gptube-api/generated-api/models/index.ts +++ b/gptube/gptube-api/generated-api/models/index.ts @@ -46,7 +46,6 @@ export * from './ModelsYoutubeVideoAnalyzed'; export * from './ModelsYoutubeVideoDashboard'; export * from './ModelsYoutubeVideoNegativeCommentsRespBody'; export * from './ModelsYoutubeVideosRespBody'; -export * from './UtilsHandleErrorErrorResponse'; export * from './YoutubeComment'; export * from './YoutubeCommentSnippet'; export * from './YoutubeCommentSnippetAuthorChannelId'; diff --git a/gptube/hooks/use-auth.ts b/gptube/hooks/use-auth.ts index 756f4ae..07dc09f 100644 --- a/gptube/hooks/use-auth.ts +++ b/gptube/hooks/use-auth.ts @@ -32,8 +32,8 @@ export function useAuthActions() { try { await loginWithCredentials(data) - toast.success('Logged successfully ๐Ÿ˜ธ') - router.push('/') + toast.success('Logged in successfully ๐Ÿ˜ธ') + router.push('/dashboard') } catch (error) { if (error instanceof Error) { return toast.error(error.message) @@ -46,8 +46,8 @@ export function useAuthActions() { const loginWithGoogleHandler = async () => { try { await loginWithGoogle() - toast.success('Logged successfully ๐Ÿ˜ธ') - router.push('/') + toast.success('Logged in successfully ๐Ÿ˜ธ') + router.push('/dashboard') } catch (error) { if (error instanceof Error) { return toast.error(error.message) @@ -95,7 +95,7 @@ export function useAuthActions() { try { await signup(data) toast.success('Signed up successfully ๐Ÿ˜ธ') - router.push('/') + router.push('/dashboard') } catch (error) { if (error instanceof Error) { return toast.error(error.message) diff --git a/gptube/swagger.yaml b/gptube/swagger.yaml index 70d6cbb..071296a 100644 --- a/gptube/swagger.yaml +++ b/gptube/swagger.yaml @@ -653,12 +653,6 @@ definitions: $ref: '#/definitions/models.YoutubeVideoDashboard' type: array type: object - utils.HandleError.errorResponse: - properties: - error: - example: an error ocurred - type: string - type: object youtube.Comment: properties: etag: @@ -949,18 +943,18 @@ paths: description: OK schema: $ref: '#/definitions/models.YoutubeAnalyzerRespBody' - "204": - description: No Content - schema: - $ref: '#/definitions/utils.HandleError.errorResponse' "400": description: Bad Request schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' + "404": + description: Not Found + schema: + $ref: '#/definitions/fiber.Error' "500": description: Internal Server Error schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' summary: Performs the analysis of the youtube video /api/youtube/analysis-landing: post: @@ -980,18 +974,18 @@ paths: description: OK schema: $ref: '#/definitions/models.YoutubeAnalyzerLandingRespBody' - "204": - description: No Content - schema: - $ref: '#/definitions/utils.HandleError.errorResponse' "400": description: Bad Request schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' + "404": + description: Not Found + schema: + $ref: '#/definitions/fiber.Error' "500": description: Internal Server Error schema: - $ref: '#/definitions/utils.HandleError.errorResponse' + $ref: '#/definitions/fiber.Error' summary: Simple analysis with BERT model for the landing page /api/youtube/pre-analysis: post: