@s-hirano-ist/s-database 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +49 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Database package providing Prisma client and types for the content management system.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This package wraps the Prisma ORM client and provides:
|
|
8
|
+
* - Type-safe database access via PrismaClient
|
|
9
|
+
* - Generated TypeScript types for all database models
|
|
10
|
+
* - PostgreSQL database connectivity
|
|
11
|
+
*
|
|
12
|
+
* ## Database Models
|
|
13
|
+
*
|
|
14
|
+
* - **Category** - Hierarchical organization for articles
|
|
15
|
+
* - **Article** - News/link management with OG metadata
|
|
16
|
+
* - **Note** - Markdown-based content storage
|
|
17
|
+
* - **Image** - File metadata with MinIO path storage
|
|
18
|
+
* - **Book** - ISBN-based book tracking with Google Books integration
|
|
19
|
+
*
|
|
20
|
+
* ## Status Lifecycle
|
|
21
|
+
*
|
|
22
|
+
* All content models follow a common status workflow:
|
|
23
|
+
* - `UNEXPORTED` - Initial state, content not yet published
|
|
24
|
+
* - `LAST_UPDATED` - Content has been modified since last export
|
|
25
|
+
* - `EXPORTED` - Content has been published/exported
|
|
26
|
+
*
|
|
27
|
+
* ## Multi-tenant Design
|
|
28
|
+
*
|
|
29
|
+
* All models include `userId` for data isolation between users.
|
|
30
|
+
* Unique constraints are scoped per user (e.g., `@@unique([url, userId])`).
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { PrismaClient } from "@s-hirano-ist/s-database";
|
|
35
|
+
*
|
|
36
|
+
* const prisma = new PrismaClient();
|
|
37
|
+
*
|
|
38
|
+
* // Fetch all unexported articles for a user
|
|
39
|
+
* const articles = await prisma.article.findMany({
|
|
40
|
+
* where: {
|
|
41
|
+
* userId: "user-123",
|
|
42
|
+
* status: "UNEXPORTED",
|
|
43
|
+
* },
|
|
44
|
+
* include: { Category: true },
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @see {@link https://www.prisma.io/docs | Prisma Documentation}
|
|
49
|
+
*/
|
|
2
50
|
|
|
3
51
|
export * from "./generated/prisma/client";
|
|
4
52
|
export { Prisma, PrismaClient } from "./generated/prisma/client";
|