Skip to content

Commit 8fd4b11

Browse files
bruh
1 parent d9edf8f commit 8fd4b11

File tree

10 files changed

+31
-16
lines changed

10 files changed

+31
-16
lines changed

apps/web/actions/spaces/remove-videos.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { folders, spaceVideos, videos } from "@cap/database/schema";
6+
import type { Video } from "@cap/web-domain";
67
import { and, eq, inArray } from "drizzle-orm";
78
import { revalidatePath } from "next/cache";
89

910
export async function removeVideosFromSpace(
1011
spaceId: string,
11-
videoIds: string[],
12+
videoIds: Video.VideoId[],
1213
) {
1314
try {
1415
const user = await getCurrentUser();

apps/web/actions/video/upload.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { nanoId } from "@cap/database/helpers";
1010
import { s3Buckets, videos, videoUploads } from "@cap/database/schema";
1111
import { buildEnv, NODE_ENV, serverEnv } from "@cap/env";
1212
import { userIsPro } from "@cap/utils";
13+
import { type Folder, Video } from "@cap/web-domain";
1314
import { eq } from "drizzle-orm";
1415
import { revalidatePath } from "next/cache";
1516
import { dub } from "@/utils/dub";
@@ -156,14 +157,14 @@ export async function createVideoAndGetUploadUrl({
156157
isUpload = false,
157158
folderId,
158159
}: {
159-
videoId?: string;
160+
videoId?: Video.VideoId;
160161
duration?: number;
161162
resolution?: string;
162163
videoCodec?: string;
163164
audioCodec?: string;
164165
isScreenshot?: boolean;
165166
isUpload?: boolean;
166-
folderId?: string;
167+
folderId?: Folder.FolderId;
167168
}) {
168169
const user = await getCurrentUser();
169170

@@ -211,7 +212,7 @@ export async function createVideoAndGetUploadUrl({
211212
}
212213
}
213214

214-
const idToUse = videoId || nanoId();
215+
const idToUse = Video.VideoId.make(videoId || nanoId());
215216

216217
const bucket = await createBucketProvider(customBucket);
217218

apps/web/actions/videos/download.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { videos } from "@cap/database/schema";
6+
import type { Video } from "@cap/web-domain";
67
import { eq } from "drizzle-orm";
78
import { createBucketProvider } from "@/utils/s3";
89

9-
export async function downloadVideo(videoId: string) {
10+
export async function downloadVideo(videoId: Video.VideoId) {
1011
const user = await getCurrentUser();
1112

1213
if (!user || !videoId) {

apps/web/actions/videos/edit-date.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { videos } from "@cap/database/schema";
66
import type { VideoMetadata } from "@cap/database/types";
7+
import type { Video } from "@cap/web-domain";
78
import { eq } from "drizzle-orm";
89
import { revalidatePath } from "next/cache";
910

10-
export async function editDate(videoId: string, date: string) {
11+
export async function editDate(videoId: Video.VideoId, date: string) {
1112
const user = await getCurrentUser();
1213

1314
if (!user || !date || !videoId) {

apps/web/actions/videos/edit-title.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { videos } from "@cap/database/schema";
6+
import type { Video } from "@cap/web-domain";
67
import { eq } from "drizzle-orm";
78
import { revalidatePath } from "next/cache";
89

9-
export async function editTitle(videoId: string, title: string) {
10+
export async function editTitle(videoId: Video.VideoId, title: string) {
1011
const user = await getCurrentUser();
1112

1213
if (!user || !title || !videoId) {

apps/web/actions/videos/edit-transcript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"use server";
22

3-
import { GetObjectCommand, PutObjectCommand } from "@aws-sdk/client-s3";
43
import { db } from "@cap/database";
54
import { getCurrentUser } from "@cap/database/auth/session";
65
import { s3Buckets, videos } from "@cap/database/schema";
6+
import type { Video } from "@cap/web-domain";
77
import { eq } from "drizzle-orm";
88
import { revalidatePath } from "next/cache";
99
import { createBucketProvider } from "@/utils/s3";
1010

1111
export async function editTranscriptEntry(
12-
videoId: string,
12+
videoId: Video.VideoId,
1313
entryId: number,
1414
newText: string,
1515
): Promise<{ success: boolean; message: string }> {

apps/web/actions/videos/get-og-image.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { db } from "@cap/database";
22
import { s3Buckets, videos } from "@cap/database/schema";
3+
import type { Video } from "@cap/web-domain";
34
import { eq } from "drizzle-orm";
45
import { ImageResponse } from "next/og";
56
import { createBucketProvider } from "@/utils/s3";
67

7-
export async function generateVideoOgImage(videoId: string) {
8+
export async function generateVideoOgImage(videoId: Video.VideoId) {
89
const videoData = await getData(videoId);
910

1011
if (!videoData) {
@@ -145,7 +146,7 @@ export async function generateVideoOgImage(videoId: string) {
145146
);
146147
}
147148

148-
async function getData(videoId: string) {
149+
async function getData(videoId: Video.VideoId) {
149150
const query = await db()
150151
.select({
151152
video: videos,

apps/web/actions/videos/get-transcript.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { s3Buckets, videos } from "@cap/database/schema";
6+
import type { Video } from "@cap/web-domain";
67
import { eq } from "drizzle-orm";
78
import { createBucketProvider } from "@/utils/s3";
89

910
export async function getTranscript(
10-
videoId: string,
11+
videoId: Video.VideoId,
1112
): Promise<{ success: boolean; content?: string; message: string }> {
1213
const user = await getCurrentUser();
1314

apps/web/actions/videos/new-comment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { nanoId } from "@cap/database/helpers";
66
import { comments } from "@cap/database/schema";
7+
import type { Video } from "@cap/web-domain";
78
import { revalidatePath } from "next/cache";
89
import { createNotification } from "@/lib/Notification";
910

1011
export async function newComment(data: {
1112
content: string;
12-
videoId: string;
13+
videoId: Video.VideoId;
1314
type: "text" | "emoji";
1415
parentCommentId: string;
1516
}) {

apps/web/actions/videos/password.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import { db } from "@cap/database";
44
import { getCurrentUser } from "@cap/database/auth/session";
55
import { encrypt, hashPassword, verifyPassword } from "@cap/database/crypto";
66
import { videos } from "@cap/database/schema";
7+
import type { Video } from "@cap/web-domain";
78
import { eq } from "drizzle-orm";
89
import { revalidatePath } from "next/cache";
910
import { cookies } from "next/headers";
1011

11-
export async function setVideoPassword(videoId: string, password: string) {
12+
export async function setVideoPassword(
13+
videoId: Video.VideoId,
14+
password: string,
15+
) {
1216
try {
1317
const user = await getCurrentUser();
1418

@@ -42,7 +46,7 @@ export async function setVideoPassword(videoId: string, password: string) {
4246
}
4347
}
4448

45-
export async function removeVideoPassword(videoId: string) {
49+
export async function removeVideoPassword(videoId: Video.VideoId) {
4650
try {
4751
const user = await getCurrentUser();
4852

@@ -75,7 +79,10 @@ export async function removeVideoPassword(videoId: string) {
7579
}
7680
}
7781

78-
export async function verifyVideoPassword(videoId: string, password: string) {
82+
export async function verifyVideoPassword(
83+
videoId: Video.VideoId,
84+
password: string,
85+
) {
7986
try {
8087
if (!videoId || typeof password !== "string")
8188
throw new Error("Missing data");

0 commit comments

Comments
 (0)