mirror of
https://github.com/willchen96/mike.git
synced 2026-07-06 22:12:10 +02:00
Merge pull request #52 from willchen96/sync/jsonb-shared-with-s3-path-style
fix: handle JSONB shared_with filters and path-style S3
This commit is contained in:
commit
029181b2ff
3 changed files with 3 additions and 2 deletions
|
|
@ -135,7 +135,7 @@ export async function listAccessibleProjectIds(
|
||||||
? db
|
? db
|
||||||
.from("projects")
|
.from("projects")
|
||||||
.select("id")
|
.select("id")
|
||||||
.contains("shared_with", [userEmail])
|
.filter("shared_with", "cs", JSON.stringify([userEmail]))
|
||||||
.neq("user_id", userId)
|
.neq("user_id", userId)
|
||||||
: Promise.resolve({ data: [] as { id: string }[] }),
|
: Promise.resolve({ data: [] as { id: string }[] }),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ function getClient(): S3Client {
|
||||||
return new S3Client({
|
return new S3Client({
|
||||||
region: "auto",
|
region: "auto",
|
||||||
endpoint: process.env.R2_ENDPOINT_URL!,
|
endpoint: process.env.R2_ENDPOINT_URL!,
|
||||||
|
forcePathStyle: true,
|
||||||
credentials: {
|
credentials: {
|
||||||
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
|
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
|
||||||
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
|
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ projectsRouter.get("/", requireAuth, async (req, res) => {
|
||||||
? await db
|
? await db
|
||||||
.from("projects")
|
.from("projects")
|
||||||
.select("*")
|
.select("*")
|
||||||
.contains("shared_with", [userEmail])
|
.filter("shared_with", "cs", JSON.stringify([userEmail]))
|
||||||
.neq("user_id", userId)
|
.neq("user_id", userId)
|
||||||
.order("created_at", { ascending: false })
|
.order("created_at", { ascending: false })
|
||||||
: { data: [], error: null };
|
: { data: [], error: null };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue