adorn-api 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/README.md +7 -7
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -272,7 +272,7 @@ Database-driven API using Metal ORM entities. See: `examples/blog-platform-metal
272
272
 
273
273
  ```typescript
274
274
  import { Controller, Get, Post, Put, Delete } from "adorn-api";
275
- import { Post as PostEntity } from "../entities/index.js";
275
+ import { BlogPost } from "../entities/index.js";
276
276
  import { getSession, selectFromEntity, eq } from "metal-orm";
277
277
 
278
278
  @Controller("/posts")
@@ -280,9 +280,9 @@ export class PostsController {
280
280
  @Get("/")
281
281
  async getPosts(query?: { authorId?: number; status?: string }) {
282
282
  const session = getSession();
283
- let qb = selectFromEntity(PostEntity);
284
- if (query?.authorId) qb = qb.where(eq(PostEntity.authorId, query.authorId));
285
- if (query?.status) qb = qb.where(eq(PostEntity.status, query.status));
283
+ let qb = selectFromEntity(BlogPost);
284
+ if (query?.authorId) qb = qb.where(eq(BlogPost.authorId, query.authorId));
285
+ if (query?.status) qb = qb.where(eq(BlogPost.status, query.status));
286
286
  return qb.execute(session);
287
287
  }
288
288
 
@@ -290,9 +290,9 @@ export class PostsController {
290
290
  async getPost(id: number) { /* ... */ }
291
291
 
292
292
  @Post("/")
293
- async createPost(body: Pick<PostEntity, "title" | "content" | "authorId">) {
293
+ async createPost(body: Pick<BlogPost, "title" | "content" | "authorId">) {
294
294
  const session = getSession();
295
- const post = new PostEntity();
295
+ const post = new BlogPost();
296
296
  Object.assign(post, body);
297
297
  await session.persist(post);
298
298
  await session.flush();
@@ -300,7 +300,7 @@ export class PostsController {
300
300
  }
301
301
 
302
302
  @Put("/:id")
303
- async updatePost(id: number, body: Partial<PostEntity>) { /* ... */ }
303
+ async updatePost(id: number, body: Partial<BlogPost>) { /* ... */ }
304
304
 
305
305
  @Delete("/:id")
306
306
  async deletePost(id: number) { return { success: true }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adorn-api",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Stage-3 decorator-first OpenAPI + routing toolkit",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -64,9 +64,9 @@
64
64
  "dependencies": {
65
65
  "ajv": "^8.17.1",
66
66
  "ajv-formats": "^3.0.1",
67
- "metal-orm": "^1.0.66",
68
- "typescript": "^5.9.0",
69
- "swagger-ui-express": "^5.0.0"
67
+ "metal-orm": "^1.0.71",
68
+ "swagger-ui-express": "^5.0.0",
69
+ "typescript": "^5.9.0"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "express": "^4.18.0 || ^5.0.0"