Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,13 @@ UPSTASH_SEARCH_TOKEN=
- **Performance**: Optimized search indexing with automatic content updates

## Development Workflow Guidance
- Do not build the app after every change you make, only rebuild the app when I ask you to or after making large changes spanning many files
- Do not build the app after every change you make, only rebuild the app when I ask you to or after making large changes spanning many files

## Code Style Guidelines
- **No obvious comments**: Never add comments for obvious code. Comments should only provide context or insights that aren't clear from reading the code itself
- **Self-documenting code**: Write code that is clear and self-explanatory. Variable and function names should describe what they do
- **Avoid unnecessary intermediate variables**: Don't create variables just to "improve readability" when the expression is already clear
- Examples of bad comments to avoid:
- `// Use current time as the start` before `buildQuery(now, end)`
- `// Increment counter` before `i++`
- `// Check if user exists` before `if (user)`
11 changes: 10 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@upstash/search": "^0.1.5",
"@upstash/workflow": "^0.2.16",
"autoprefixer": "10.4.14",
"caniuse-lite": "^1.0.30001731",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
Expand Down
7 changes: 4 additions & 3 deletions trpc/routers/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ export const eventsRouter = createTRPCRouter({
throw new Error("Project access denied");
}

const { start, end } = getStartEndWeekRangeInUtc(
const now = new Date();
const { end } = getStartEndWeekRangeInUtc(
ctx.timezone,
new Date(),
now,
);

const events = await ctx.db.query.calendarEvent
.findMany(buildEventsQuery(projectId, start, end))
.findMany(buildEventsQuery(projectId, now, end))
.execute();

return events;
Expand Down
30 changes: 16 additions & 14 deletions trpc/routers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,22 @@ export const userRouter = createTRPCRouter({

// Get projects where user has explicit permissions OR is the creator
const projects = await ctx.db.query.project.findMany({
where: and(
or(
// User has explicit permission
userPermissions.length > 0
? inArray(
project.id,
userPermissions.map((p) => p.projectId),
)
: undefined,
// User is the creator (for backward compatibility)
eq(project.createdByUser, ctx.userId),
),
or(...statusFilter),
),
where: ctx.isOrgAdmin
? or(...statusFilter)
: and(
or(
// User has explicit permission
userPermissions.length > 0
? inArray(
project.id,
userPermissions.map((p) => p.projectId),
)
: undefined,
// User is the creator (for backward compatibility)
eq(project.createdByUser, ctx.userId),
),
or(...statusFilter),
),
with: {
creator: true,
},
Expand Down