chore(release): v0.0.1
Browse files
apps/server/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { createContext } from "@labas/api/context";
|
|
| 3 |
import { appRouter } from "@labas/api/routers/index";
|
| 4 |
import { auth } from "@labas/auth";
|
| 5 |
import { env } from "@labas/env/server";
|
| 6 |
-
import {
|
| 7 |
import { Hono } from "hono";
|
| 8 |
import { cors } from "hono/cors";
|
| 9 |
|
|
|
|
| 3 |
import { appRouter } from "@labas/api/routers/index";
|
| 4 |
import { auth } from "@labas/auth";
|
| 5 |
import { env } from "@labas/env/server";
|
| 6 |
+
import { withRequestId } from "@labas/api/logger";
|
| 7 |
import { Hono } from "hono";
|
| 8 |
import { cors } from "hono/cors";
|
| 9 |
|
apps/web/tsconfig.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
"module": "ESNext",
|
| 8 |
"moduleResolution": "Bundler",
|
| 9 |
"skipLibCheck": true,
|
| 10 |
-
"types": ["vite/client"],
|
| 11 |
"rootDirs": ["."],
|
| 12 |
"paths": {
|
| 13 |
"@/*": ["./src/*"],
|
|
|
|
| 7 |
"module": "ESNext",
|
| 8 |
"moduleResolution": "Bundler",
|
| 9 |
"skipLibCheck": true,
|
| 10 |
+
"types": ["vite/client", "bun"],
|
| 11 |
"rootDirs": ["."],
|
| 12 |
"paths": {
|
| 13 |
"@/*": ["./src/*"],
|
package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "labas",
|
|
|
|
| 3 |
"private": true,
|
| 4 |
"workspaces": {
|
| 5 |
"packages": [
|
|
|
|
| 1 |
{
|
| 2 |
"name": "labas",
|
| 3 |
+
"version": "0.0.1",
|
| 4 |
"private": true,
|
| 5 |
"workspaces": {
|
| 6 |
"packages": [
|
packages/api/src/lib/ownership.ts
CHANGED
|
@@ -13,8 +13,7 @@ export function assertOwnership(row: OwnedRow | null | undefined, userId: string
|
|
| 13 |
export function ownershipFilter<TTable extends Record<string, any>>(
|
| 14 |
table: TTable,
|
| 15 |
userId: string,
|
| 16 |
-
idColumn: keyof TTable,
|
| 17 |
creatorColumn: keyof TTable,
|
| 18 |
) {
|
| 19 |
-
return eq(table[
|
| 20 |
}
|
|
|
|
| 13 |
export function ownershipFilter<TTable extends Record<string, any>>(
|
| 14 |
table: TTable,
|
| 15 |
userId: string,
|
|
|
|
| 16 |
creatorColumn: keyof TTable,
|
| 17 |
) {
|
| 18 |
+
return eq(table[creatorColumn as string], userId);
|
| 19 |
}
|
packages/api/src/lib/pagination.ts
CHANGED
|
@@ -20,6 +20,6 @@ export function paginateDefaults(input?: PaginationInput) {
|
|
| 20 |
};
|
| 21 |
}
|
| 22 |
|
| 23 |
-
export function countSql(
|
| 24 |
return sql<number>`count(*)::int`;
|
| 25 |
}
|
|
|
|
| 20 |
};
|
| 21 |
}
|
| 22 |
|
| 23 |
+
export function countSql() {
|
| 24 |
return sql<number>`count(*)::int`;
|
| 25 |
}
|
packages/api/src/lib/visibility.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { eq, or,
|
| 2 |
|
| 3 |
interface VisibilityTable {
|
| 4 |
isPublic: any;
|
|
|
|
| 1 |
+
import { eq, or, SQL } from "drizzle-orm";
|
| 2 |
|
| 3 |
interface VisibilityTable {
|
| 4 |
isPublic: any;
|
packages/api/src/routers/attempt.ts
CHANGED
|
@@ -104,7 +104,7 @@ function calculatePartialCredit(format: string, userAnswer: string, correctAnswe
|
|
| 104 |
}
|
| 105 |
|
| 106 |
// ββ Word Count Validator ββ
|
| 107 |
-
function validateWordCount(answer: string, minWords = 1, maxWords = 500): { isValid: boolean; wordCount: number } {
|
| 108 |
const trimmed = answer.trim();
|
| 109 |
if (!trimmed) return { isValid: false, wordCount: 0 };
|
| 110 |
const words = trimmed.split(/\s+/).filter(Boolean);
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
// ββ Word Count Validator ββ
|
| 107 |
+
export function validateWordCount(answer: string, minWords = 1, maxWords = 500): { isValid: boolean; wordCount: number } {
|
| 108 |
const trimmed = answer.trim();
|
| 109 |
if (!trimmed) return { isValid: false, wordCount: 0 };
|
| 110 |
const words = trimmed.split(/\s+/).filter(Boolean);
|
packages/api/src/routers/package.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
| 14 |
import { paginationSchema, paginateDefaults } from "../lib/pagination";
|
| 15 |
import { assertOwnership } from "../lib/ownership";
|
| 16 |
import { buildVisibilityCondition } from "../lib/visibility";
|
| 17 |
-
import { throwNotFound
|
| 18 |
|
| 19 |
export const packageRouter = router({
|
| 20 |
list: publicProcedure
|
|
|
|
| 14 |
import { paginationSchema, paginateDefaults } from "../lib/pagination";
|
| 15 |
import { assertOwnership } from "../lib/ownership";
|
| 16 |
import { buildVisibilityCondition } from "../lib/visibility";
|
| 17 |
+
import { throwNotFound } from "../lib/errors";
|
| 18 |
|
| 19 |
export const packageRouter = router({
|
| 20 |
list: publicProcedure
|