feat: Projects backend slice — auth, primitives, backend, UI (#3)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { Doc, Id } from "./_generated/dataModel";
|
||||
import { mutation, query } from "./_generated/server";
|
||||
import { requireOwnerId } from "./authz";
|
||||
import { requireAuthUserId } from "./authz";
|
||||
|
||||
interface OrganizationView {
|
||||
readonly _id: Id<"organizations">;
|
||||
@@ -31,7 +31,7 @@ const toView = (org: Doc<"organizations">): OrganizationView => ({
|
||||
export const ensurePersonalOrganization = mutation({
|
||||
args: {},
|
||||
handler: async (ctx): Promise<OrganizationView> => {
|
||||
const ownerId = await requireOwnerId(ctx);
|
||||
const ownerId = await requireAuthUserId(ctx);
|
||||
const existing = await ctx.db
|
||||
.query("organizations")
|
||||
.withIndex("by_createdBy_and_kind", (q) =>
|
||||
@@ -70,7 +70,7 @@ export const ensurePersonalOrganization = mutation({
|
||||
export const getCurrent = query({
|
||||
args: {},
|
||||
handler: async (ctx): Promise<OrganizationView | null> => {
|
||||
const ownerId = await requireOwnerId(ctx);
|
||||
const ownerId = await requireAuthUserId(ctx);
|
||||
const existing = await ctx.db
|
||||
.query("organizations")
|
||||
.withIndex("by_createdBy_and_kind", (q) =>
|
||||
|
||||
Reference in New Issue
Block a user