Compare commits
4 Commits
fix/label-
...
fix/mobile
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44566f4838 | ||
|
|
30b3332d1f | ||
|
|
24e418a239 | ||
|
|
4045ccbfd8 |
@@ -21,7 +21,6 @@ S3_REGION=
|
||||
S3_ENDPOINT=
|
||||
S3_ACCESS_KEY_ID=
|
||||
S3_SECRET_ACCESS_KEY=
|
||||
S3_FORCE_PATH_STYLE=
|
||||
NEXT_PUBLIC_STORAGE_URL=
|
||||
NEXT_PUBLIC_AVATAR_BUCKET_NAME=
|
||||
NEXT_PUBLIC_STORAGE_DOMAIN=
|
||||
|
||||
@@ -162,7 +162,6 @@ pnpm dev
|
||||
| `S3_ENDPOINT` | S3 endpoint URL | For file uploads | `https://xxx.r2.cloudflarestorage.com` |
|
||||
| `S3_ACCESS_KEY_ID` | S3 access key | For file uploads | `xxx` |
|
||||
| `S3_SECRET_ACCESS_KEY` | S3 secret key | For file uploads | `xxx` |
|
||||
| `S3_FORCE_PATH_STYLE` | Use path-style URLs for S3 | For file uploads | `true` |
|
||||
| `NEXT_PUBLIC_STORAGE_URL` | Storage service URL | For file uploads | `https://storage.kanbn.com` |
|
||||
| `NEXT_PUBLIC_STORAGE_DOMAIN` | Storage domain name | For file uploads | `kanbn.com` |
|
||||
| `NEXT_PUBLIC_AVATAR_BUCKET_NAME` | S3 bucket name for avatars | For file uploads | `avatars` |
|
||||
|
||||
@@ -31,12 +31,9 @@ const config = {
|
||||
|
||||
images: {
|
||||
remotePatterns: [
|
||||
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: process.env.S3_FORCE_PATH_STYLE === "true"
|
||||
? `${env("NEXT_PUBLIC_STORAGE_DOMAIN")}`
|
||||
: `*.${env("NEXT_PUBLIC_STORAGE_DOMAIN")}`,
|
||||
hostname: `*.${env("NEXT_PUBLIC_STORAGE_DOMAIN")}`,
|
||||
},
|
||||
{
|
||||
protocol: "http",
|
||||
|
||||
@@ -69,7 +69,6 @@ export const env = createEnv({
|
||||
S3_SECRET_ACCESS_KEY: z.string().optional(),
|
||||
S3_REGION: z.string().optional(),
|
||||
S3_ENDPOINT: z.string().optional(),
|
||||
S3_FORCE_PATH_STYLE: z.string().optional(),
|
||||
EMAIL_FROM: z.string().optional(),
|
||||
},
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ export default async function handler(
|
||||
const client = new S3Client({
|
||||
region: env.S3_REGION ?? "",
|
||||
endpoint: env.S3_ENDPOINT ?? "",
|
||||
forcePathStyle: env.S3_FORCE_PATH_STYLE === "true",
|
||||
credentials: {
|
||||
accessKeyId: env.S3_ACCESS_KEY_ID ?? "",
|
||||
secretAccessKey: env.S3_SECRET_ACCESS_KEY ?? "",
|
||||
@@ -59,7 +58,6 @@ export default async function handler(
|
||||
new PutObjectCommand({
|
||||
Bucket: nextRuntimeEnv("NEXT_PUBLIC_AVATAR_BUCKET_NAME") ?? "",
|
||||
Key: filename,
|
||||
ACL: "public-read",
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ services:
|
||||
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}
|
||||
- S3_REGION=${S3_REGION}
|
||||
- S3_ENDPOINT=${S3_ENDPOINT}
|
||||
- S3_FORCE_PATH_STYLE=${S3_FORCE_PATH_STYLE}
|
||||
- NEXT_PUBLIC_STORAGE_URL=${NEXT_PUBLIC_STORAGE_URL}
|
||||
- NEXT_PUBLIC_AVATAR_BUCKET_NAME=${NEXT_PUBLIC_AVATAR_BUCKET_NAME}
|
||||
- NEXT_PUBLIC_STORAGE_DOMAIN=${NEXT_PUBLIC_STORAGE_DOMAIN}
|
||||
|
||||
@@ -30,7 +30,6 @@ services:
|
||||
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}
|
||||
- S3_REGION=${S3_REGION}
|
||||
- S3_ENDPOINT=${S3_ENDPOINT}
|
||||
- S3_FORCE_PATH_STYLE=${S3_FORCE_PATH_STYLE}
|
||||
- NEXT_PUBLIC_STORAGE_URL=${NEXT_PUBLIC_STORAGE_URL}
|
||||
- NEXT_PUBLIC_AVATAR_BUCKET_NAME=${NEXT_PUBLIC_AVATAR_BUCKET_NAME}
|
||||
- NEXT_PUBLIC_STORAGE_DOMAIN=${NEXT_PUBLIC_STORAGE_DOMAIN}
|
||||
|
||||
@@ -8,12 +8,6 @@ import * as labelRepo from "@kan/db/repository/label.repo";
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
import { assertUserInWorkspace } from "../utils/auth";
|
||||
|
||||
const labelSchema = z.object({
|
||||
publicId: z.string(),
|
||||
name: z.string(),
|
||||
colourCode: z.string().nullable(),
|
||||
});
|
||||
|
||||
export const labelRouter = createTRPCRouter({
|
||||
byPublicId: protectedProcedure
|
||||
.meta({
|
||||
@@ -27,7 +21,7 @@ export const labelRouter = createTRPCRouter({
|
||||
},
|
||||
})
|
||||
.input(z.object({ labelPublicId: z.string().min(12) }))
|
||||
.output(labelSchema)
|
||||
.output(z.custom<Awaited<ReturnType<typeof labelRepo.getByPublicId>>>())
|
||||
.query(async ({ ctx, input }) => {
|
||||
const userId = ctx.user?.id;
|
||||
|
||||
@@ -58,11 +52,7 @@ export const labelRouter = createTRPCRouter({
|
||||
code: "NOT_FOUND",
|
||||
});
|
||||
|
||||
return {
|
||||
publicId: result.publicId,
|
||||
name: result.name,
|
||||
colourCode: result.colourCode,
|
||||
};
|
||||
return result;
|
||||
}),
|
||||
create: protectedProcedure
|
||||
.meta({
|
||||
@@ -82,7 +72,7 @@ export const labelRouter = createTRPCRouter({
|
||||
colourCode: z.string().length(7),
|
||||
}),
|
||||
)
|
||||
.output(labelSchema)
|
||||
.output(z.custom<Awaited<ReturnType<typeof labelRepo.create>>>())
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const userId = ctx.user?.id;
|
||||
|
||||
@@ -118,11 +108,7 @@ export const labelRouter = createTRPCRouter({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
});
|
||||
|
||||
return {
|
||||
publicId: result.publicId,
|
||||
name: result.name,
|
||||
colourCode: result.colourCode,
|
||||
};
|
||||
return result;
|
||||
}),
|
||||
update: protectedProcedure
|
||||
.meta({
|
||||
@@ -142,7 +128,7 @@ export const labelRouter = createTRPCRouter({
|
||||
colourCode: z.string().length(7),
|
||||
}),
|
||||
)
|
||||
.output(labelSchema)
|
||||
.output(z.custom<Awaited<ReturnType<typeof labelRepo.update>>>())
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const userId = ctx.user?.id;
|
||||
|
||||
@@ -167,17 +153,7 @@ export const labelRouter = createTRPCRouter({
|
||||
|
||||
const result = await labelRepo.update(ctx.db, input);
|
||||
|
||||
if (!result)
|
||||
throw new TRPCError({
|
||||
message: `Failed to update label`,
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
});
|
||||
|
||||
return {
|
||||
publicId: result.publicId,
|
||||
name: result.name,
|
||||
colourCode: result.colourCode,
|
||||
};
|
||||
return result;
|
||||
}),
|
||||
delete: protectedProcedure
|
||||
.meta({
|
||||
|
||||
@@ -181,7 +181,6 @@ export const initAuth = (db: dbClient) => {
|
||||
const client = new S3Client({
|
||||
region: env("S3_REGION") ?? "",
|
||||
endpoint: env("S3_ENDPOINT") ?? "",
|
||||
forcePathStyle: env("S3_FORCE_PATH_STYLE") === "true",
|
||||
credentials: {
|
||||
accessKeyId: env("S3_ACCESS_KEY_ID") ?? "",
|
||||
secretAccessKey: env("S3_SECRET_ACCESS_KEY") ?? "",
|
||||
|
||||
@@ -23,12 +23,7 @@ export const create = async (
|
||||
createdBy: labelInput.createdBy,
|
||||
boardId: labelInput.boardId,
|
||||
})
|
||||
.returning({
|
||||
id: labels.id,
|
||||
publicId: labels.publicId,
|
||||
name: labels.name,
|
||||
colourCode: labels.colourCode,
|
||||
});
|
||||
.returning({ id: labels.id });
|
||||
|
||||
if (labelInput.cardId && result) {
|
||||
await db.insert(cardsToLabels).values({
|
||||
@@ -96,7 +91,6 @@ export const update = async (
|
||||
.where(eq(labels.publicId, labelInput.labelPublicId))
|
||||
.returning({
|
||||
id: labels.id,
|
||||
publicId: labels.publicId,
|
||||
name: labels.name,
|
||||
colourCode: labels.colourCode,
|
||||
});
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
"S3_ACCESS_KEY_ID",
|
||||
"S3_SECRET_ACCESS_KEY",
|
||||
"S3_ENDPOINT",
|
||||
"S3_FORCE_PATH_STYLE",
|
||||
"PORT",
|
||||
"BETTER_AUTH_SECRET",
|
||||
"BETTER_AUTH_TRUSTED_ORIGINS"
|
||||
|
||||
Reference in New Issue
Block a user