-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from hubcio2115/feat/create-project-form-youtube
Feat/create-project-form-youtube
- Loading branch information
Showing
67 changed files
with
4,640 additions
and
2,744 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v22.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,3 @@ To start you'll need: | |
- `[email protected]` | ||
- run `pnpm install` | ||
- copy `.env.local.example` in `./apps/web` and rename it to `.env.local` | ||
|
||
### Webhooks | ||
We're using [Mux](https://www.mux.com/) for storing, uploading and preprocessing videos. | ||
For *Mux* to communicate with our app it needs a webhook. But for localdevelopment | ||
it doesn't have access to our local ip address. To fix that you'll need to forward your port to | ||
the web. | ||
|
||
We recommend [ngrok](https://ngrok.com/) for that. You can also figure it our yourself. :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
apps/web/src/app/api/organizations/[name]/owner-channels/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { isUserInOrganization } from "~/server/api/utils/organizations"; | ||
import { getOwnerChannels } from "~/server/api/utils/project"; | ||
import { auth } from "~/server/auth"; | ||
|
||
export async function GET( | ||
_req: NextRequest, | ||
{ params }: { params: { name: string } }, | ||
) { | ||
const session = await auth(); | ||
|
||
const isUserAuthorized = | ||
session?.user && (await isUserInOrganization(session.user.id, params.name)); | ||
|
||
if (!isUserAuthorized) { | ||
return NextResponse.json({ message: "UNAUTHORIZED" }, { status: 401 }); | ||
} | ||
|
||
const [channels, err] = await getOwnerChannels(params.name); | ||
|
||
if (err !== null) { | ||
return NextResponse.json( | ||
{ message: "Something went wrong on our end", cause: err }, | ||
{ status: 500 }, | ||
); | ||
} | ||
|
||
return NextResponse.json(channels); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextResponse } from "next/server"; | ||
import { getYoutubeCategories } from "~/server/api/utils/project"; | ||
import { auth } from "~/server/auth"; | ||
|
||
export async function GET() { | ||
const session = auth(); | ||
|
||
if (!session) { | ||
return NextResponse.json({ message: "UNAUTHORIZED" }, { status: 401 }); | ||
} | ||
|
||
const [categories, err] = await getYoutubeCategories(); | ||
|
||
if (err !== null) { | ||
return NextResponse.json( | ||
{ message: "Something went wrong on our end", cause: err }, | ||
{ status: 500 }, | ||
); | ||
} | ||
|
||
return NextResponse.json(categories); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextResponse } from "next/server"; | ||
import { getYoutubeSupportedLanguages } from "~/server/api/utils/project"; | ||
import { auth } from "~/server/auth"; | ||
|
||
export async function GET() { | ||
const session = auth(); | ||
|
||
if (!session) { | ||
return NextResponse.json({ message: "UNAUTHORIZED" }, { status: 401 }); | ||
} | ||
|
||
const [languages, err] = await getYoutubeSupportedLanguages(); | ||
|
||
if (err !== null) { | ||
return NextResponse.json( | ||
{ message: "Something went wrong on our end", cause: err }, | ||
{ status: 500 }, | ||
); | ||
} | ||
|
||
return NextResponse.json(languages); | ||
} |
43 changes: 23 additions & 20 deletions
43
apps/web/src/app/dashboard/[name]/create-project/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import VideUploadForm from "~/components/create-project/create-project-form"; | ||
import { createEndpointForMuxUpload } from "~/server/actions/mux"; | ||
import { getOwnOrganizationByName } from "~/server/actions/organization"; | ||
"use client"; | ||
|
||
type CreateProjectPageProps = { | ||
params: { | ||
name: string; | ||
}; | ||
}; | ||
import { useRouter } from "next/navigation"; | ||
import ProjectForm from "~/components/create-project/project-form"; | ||
import { useCreateProjectMutation } from "~/lib/mutations/useCreateProjectMutation"; | ||
|
||
export default async function CreateProjectPage({ | ||
params, | ||
}: CreateProjectPageProps) { | ||
const [upload, uploadErr] = await createEndpointForMuxUpload(); | ||
if (uploadErr !== null) { | ||
throw new Error(uploadErr); | ||
} | ||
interface CreateProjectPageProps { | ||
params: { name: string }; | ||
} | ||
|
||
export default function CreateProjectPage({ params }: CreateProjectPageProps) { | ||
const router = useRouter(); | ||
|
||
const [org, err] = await getOwnOrganizationByName(params.name); | ||
if (err !== null) { | ||
throw new Error(err); | ||
} | ||
const mutation = useCreateProjectMutation(params.name, { | ||
onSuccess: (project) => { | ||
router.push(`/dashboard/${params.name}/project/${project.id}`); | ||
}, | ||
onError: (err) => { | ||
console.error(err); | ||
}, | ||
}); | ||
|
||
return <VideUploadForm upload={upload} org={org} />; | ||
return ( | ||
<div className="container flex max-w-[800px] flex-1 flex-col items-center pb-11"> | ||
<ProjectForm mutation={mutation} /> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.