3.1.1
This commit is contained in:
parent
b4c0b3bd53
commit
4200f9ffc1
6 changed files with 9 additions and 39 deletions
|
@ -11,7 +11,7 @@ A scrum poker tool that helps agile teams plan their sprints in real-time.
|
|||
- Real-time pub/sub: Ably
|
||||
- ORM: Drizzle ORM
|
||||
- Database: Turso (libSQL)
|
||||
- Cache: Redis
|
||||
- Cache: Upstash (Redis)
|
||||
|
||||
## Versioning
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ export const EventTypes = {
|
|||
ROOM_LIST_UPDATE: "room.list.update",
|
||||
ROOM_UPDATE: "room.update",
|
||||
VOTE_UPDATE: "vote.update",
|
||||
STATS_UPDATE: "stats.update",
|
||||
} as const;
|
||||
export type EventType = BetterEnum<typeof EventTypes>;
|
||||
|
||||
|
|
|
@ -150,8 +150,6 @@ export async function PUT(
|
|||
}
|
||||
|
||||
await db.delete(votes).where(eq(votes.roomId, params.roomId));
|
||||
|
||||
await invalidateCache(`kv_votes_${params.roomId}`);
|
||||
}
|
||||
|
||||
const newRoom = await db
|
||||
|
|
|
@ -47,20 +47,12 @@ export async function PUT(
|
|||
const success = upsertResult.rowsAffected > 0;
|
||||
|
||||
if (success) {
|
||||
await invalidateCache(`kv_votes_${params.roomId}`);
|
||||
|
||||
await publishToChannel(
|
||||
`${params.roomId}`,
|
||||
EventTypes.VOTE_UPDATE,
|
||||
reqBody.value
|
||||
);
|
||||
|
||||
await publishToChannel(
|
||||
`stats`,
|
||||
EventTypes.STATS_UPDATE,
|
||||
JSON.stringify(success)
|
||||
);
|
||||
|
||||
return NextResponse.json(upsertResult, {
|
||||
status: 200,
|
||||
statusText: "SUCCESS",
|
||||
|
|
|
@ -18,31 +18,12 @@ export async function GET(
|
|||
});
|
||||
}
|
||||
|
||||
const cachedResult = await fetchCache<
|
||||
{
|
||||
id: string;
|
||||
value: string;
|
||||
created_at: Date;
|
||||
userId: string;
|
||||
roomId: string;
|
||||
}[]
|
||||
>(`kv_votes_${params.roomId}`);
|
||||
|
||||
if (cachedResult) {
|
||||
return NextResponse.json(cachedResult, {
|
||||
status: 200,
|
||||
statusText: "SUCCESS!",
|
||||
});
|
||||
} else {
|
||||
const votesByRoomId = await db.query.votes.findMany({
|
||||
where: eq(votes.roomId, params.roomId),
|
||||
});
|
||||
|
||||
await setCache(`kv_votes_${params.roomId}`, votesByRoomId);
|
||||
|
||||
return NextResponse.json(votesByRoomId, {
|
||||
status: 200,
|
||||
statusText: "SUCCESS!",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sprintpadawan",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"description": "Plan. Sprint. Repeat.",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
Loading…
Add table
Reference in a new issue