Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SkidGod4444 authored Jan 10, 2025
2 parents 2876ca1 + aa5d3ca commit e558678
Show file tree
Hide file tree
Showing 21 changed files with 144 additions and 143 deletions.
6 changes: 3 additions & 3 deletions apps/api/app/v1/[[...route]]/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const app = new Hono()
const project = await prisma.project.create({
data: {
name: body.name,
ownerId: session.user.id,
userId: session.user.id,
slug: nanoid(),
workspaceId: body.workspaceId,
},
Expand All @@ -71,7 +71,7 @@ const app = new Hono()
const existingProject = await prisma.project.findUnique({
where: {
id: projectId,
ownerId: session.user.id,
userId: session.user.id,
},
});
if (!existingProject) {
Expand All @@ -81,7 +81,7 @@ const app = new Hono()
const project = await prisma.project.delete({
where: {
id: projectId,
ownerId: session.user.id,
userId: session.user.id,
},
});

Expand Down
4 changes: 1 addition & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@
"@plura/mail": "workspace:*",
"@prisma/client": "^5.22.0",
"@repo/types": "workspace:*",
"@plura/cache": "workspace:*",
"@plura/crypt":"workspace:*",
"@plura/mor":"workspace:*",
"@upstash/ratelimit": "^2.0.5",
"@upstash/redis": "^1.34.3",
"hono": "^4.6.9",

"nanoid": "^5.0.9",
"next": "15.1.3",
"next": "15.1.4",

"prisma": "^5.22.0",
"react": "19.0.0-rc-02c0e824-20241028",
Expand Down
9 changes: 7 additions & 2 deletions apps/app/actions/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { betterFetch } from "@better-fetch/fetch";
import { getSession } from "./session";
import { headers } from "next/headers";

const API_ENDPOINT =
process.env.NODE_ENV === "production"
? "https://api.plura.pro/"
: "http://localhost:3001";

export const createProject = async ({
workspaceId,
name,
Expand All @@ -15,7 +20,7 @@ export const createProject = async ({
if (!user) {
return;
}
const project = await betterFetch("http://localhost:3001/v1/project", {
const project = await betterFetch(`${API_ENDPOINT}/v1/project`, {
method: "POST",
body: {
workspaceId: workspaceId,
Expand All @@ -36,7 +41,7 @@ export const getProjectOfUser = async (workspaceId: string) => {
}
try {
const project: any = await betterFetch(
"http://localhost:3001/v1/project/workspace/" + workspaceId,
`${API_ENDPOINT}/v1/project/workspace/` + workspaceId,
{
method: "GET",
headers: {
Expand Down
9 changes: 7 additions & 2 deletions apps/app/actions/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ import { headers } from "next/headers";
import { getSession } from "./session";
import { betterFetch } from "@better-fetch/fetch";

const API_ENDPOINT =
process.env.NODE_ENV === "production"
? "https://api.plura.pro/"
: "http://localhost:3001";

export const createWorkspace = async (workspaceName: string) => {
const user = await getSession();
if (!user) {
return;
}
try {
console.log("workspaceName", workspaceName);
const workspace = await betterFetch("http://localhost:3001/v1/workspace", {
const workspace = await betterFetch(`${API_ENDPOINT}/v1/workspace`, {
method: "POST",
body: {
name: workspaceName,
Expand All @@ -34,7 +39,7 @@ export const getFirstWorkspaceOfUser = async () => {

try {
const workspace: any = await betterFetch(
"http://localhost:3001/v1/workspace/user/" + user.session.userId,
`${API_ENDPOINT}/v1/workspace/user/` + user.session.userId,
{
method: "GET",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"input-otp": "^1.4.1",
"lucide-react": "^0.454.0",
"motion": "^11.12.0",
"next": "15.1.3",
"next": "15.1.4",
"next-themes": "^0.4.3",
"react": "19.0.0-rc-02c0e824-20241028",
"react-beautiful-dnd": "^13.1.1",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"@plura/cache": "workspace:*",
"@plura/db": "workspace:*",
"@supabase/supabase-js": "^2.46.1",
"@trigger.dev/sdk": "3.3.7"
"@trigger.dev/sdk": "3.3.8"
},
"devDependencies": {
"@trigger.dev/build": "3.3.7"
"@trigger.dev/build": "3.3.8"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ export const publishContributorsTask = schedules.task({
});
}

const finalContributors = Object.values(contributorsMap);
// Create final array sorted by contributions in descending order
const finalContributors = Object.values(contributorsMap).sort(
(a, b) => b.contributions - a.contributions,
);

// Clear Redis list and push sorted array as a list
await cache.del(redisKey); // Clear previous data
await cache.rpush(
redisKey,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clsx": "^2.1.1",
"geist": "^1.3.1",
"lucide-react": "^0.454.0",
"next": "15.1.3",
"next": "15.1.4",
"next-themes": "^0.4.3",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
Expand Down
2 changes: 1 addition & 1 deletion apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"geist": "^1.3.1",
"lucide-react": "^0.454.0",
"motion": "^11.13.1",
"next": "15.1.3",
"next": "15.1.4",
"next-themes": "^0.4.3",
"profanity-validator": "^1.3.6",
"react": "19.0.0-rc-02c0e824-20241028",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"eslint": "^8",
"eslint-config-next": "15.0.2",
"hono": "^4.6.9",
"next": "15.1.3",
"next": "15.1.4",
"next-auth": "5.0.0-beta.25",
"postcss": "^8",
"posthog-js": "^1.184.1",
Expand Down
5 changes: 4 additions & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
".": "./src/index.ts"
},
"scripts": {
"db:studio": "prisma studio",
"db:validate": "prisma validate",
"db:generate": "prisma generate --no-engine",
"db:push": "prisma db push --skip-generate"
"db:push": "prisma db push --skip-generate",
"db:migrate": "pnpm db:validate && prisma migrate dev"
},
"dependencies": {
"@prisma/client": "^6.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `userId` to the `Project` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Project" ADD COLUMN "userId" TEXT NOT NULL;

-- AddForeignKey
ALTER TABLE "Project" ADD CONSTRAINT "Project_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `ownerId` on the `Project` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Project" DROP COLUMN "ownerId";
2 changes: 1 addition & 1 deletion packages/db/prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
22 changes: 11 additions & 11 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ model User {
sessions Session[]
accounts Account[]
workspaces Workspace[]
projects Project[]
role String @default("user")
@@unique([email])
Expand Down Expand Up @@ -91,14 +92,13 @@ model Workspace {
}

model Project {
id String @id @default(uuid())
name String
ownerId String
slug String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
workspaceId String
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
id String @id @default(uuid())
name String
slug String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
workspaceId String
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
Loading

0 comments on commit e558678

Please sign in to comment.