Skip to content

Commit

Permalink
added workspace page, redirect to workspace, create workspace hooks a…
Browse files Browse the repository at this point in the history
…nd component
  • Loading branch information
Diivvuu committed Sep 26, 2024
1 parent f909fe6 commit 023faaf
Show file tree
Hide file tree
Showing 13 changed files with 7,346 additions and 8 deletions.
Binary file modified bun.lockb
Binary file not shown.
26 changes: 25 additions & 1 deletion convex/workspaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
import { query } from "./_generated/server";
import { v } from "convex/values";
import { mutation, query } from "./_generated/server";
import { auth } from "./auth";

export const create = mutation({
args: {
name: v.string(),
},
handler: async (ctx, args) => {
const userId = await auth.getUserId(ctx);

if (!userId) {
throw new Error("Unoauthorized");
}
// TODO : create proper method
const joinCode = "123456";

const workspaceId = await ctx.db.insert("workspaces", {
name: args.name,
userId,
joinCode,
});
return workspaceId;
},
});

export const get = query({
args: {},
Expand Down
Loading

0 comments on commit 023faaf

Please sign in to comment.