fragment-ts 1.0.3 → 1.0.4
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/USAGE.md +19 -19
- package/package.json +1 -1
package/USAGE.md
CHANGED
|
@@ -86,7 +86,7 @@ fragment g resource product
|
|
|
86
86
|
**src/controllers/product.controller.ts**
|
|
87
87
|
|
|
88
88
|
```typescript
|
|
89
|
-
import { Controller, Get, Post, Put, Delete, Body, Param } from "fragment";
|
|
89
|
+
import { Controller, Get, Post, Put, Delete, Body, Param } from "fragment-ts";
|
|
90
90
|
import { ProductService } from "../services/product.service";
|
|
91
91
|
|
|
92
92
|
@Controller("/products")
|
|
@@ -123,7 +123,7 @@ export class ProductController {
|
|
|
123
123
|
**src/services/product.service.ts**
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
|
-
import { Service } from "fragment";
|
|
126
|
+
import { Service } from "fragment-ts";
|
|
127
127
|
import { ProductRepository } from "../repositories/product.repository";
|
|
128
128
|
|
|
129
129
|
@Service()
|
|
@@ -255,7 +255,7 @@ export class User {
|
|
|
255
255
|
|
|
256
256
|
```typescript
|
|
257
257
|
import { Service } from "fragment";
|
|
258
|
-
import { AuthModule, NotFoundError, UnauthorizedError } from "fragment";
|
|
258
|
+
import { AuthModule, NotFoundError, UnauthorizedError } from "fragment-ts";
|
|
259
259
|
import { UserRepository } from "../repositories/user.repository";
|
|
260
260
|
|
|
261
261
|
@Service()
|
|
@@ -320,8 +320,8 @@ export class AuthService {
|
|
|
320
320
|
**src/controllers/auth.controller.ts**
|
|
321
321
|
|
|
322
322
|
```typescript
|
|
323
|
-
import { Controller, Post, Get, Body, Req } from "fragment";
|
|
324
|
-
import { AuthModule } from "fragment";
|
|
323
|
+
import { Controller, Post, Get, Body, Req } from "fragment-ts";
|
|
324
|
+
import { AuthModule } from "fragment-ts";
|
|
325
325
|
import { AuthService } from "../services/auth.service";
|
|
326
326
|
|
|
327
327
|
@Controller("/auth")
|
|
@@ -364,9 +364,9 @@ export class ProtectedController {
|
|
|
364
364
|
|
|
365
365
|
```typescript
|
|
366
366
|
import "reflect-metadata";
|
|
367
|
-
import { FragmentApplication } from "fragment";
|
|
368
|
-
import { FragmentWebApplication } from "fragment";
|
|
369
|
-
import { AuthModule } from "fragment";
|
|
367
|
+
import { FragmentApplication } from "fragment-ts";
|
|
368
|
+
import { FragmentWebApplication } from "fragment-ts";
|
|
369
|
+
import { AuthModule } from "fragment-ts";
|
|
370
370
|
|
|
371
371
|
@FragmentApplication({
|
|
372
372
|
port: 3000,
|
|
@@ -519,7 +519,7 @@ fragment seed
|
|
|
519
519
|
**src/seeds/InitialData.seed.ts**
|
|
520
520
|
|
|
521
521
|
```typescript
|
|
522
|
-
import { TypeORMModule } from "fragment";
|
|
522
|
+
import { TypeORMModule } from "fragment-ts";
|
|
523
523
|
|
|
524
524
|
export default class InitialDataSeed {
|
|
525
525
|
static async run() {
|
|
@@ -565,8 +565,8 @@ fragment generate service chat
|
|
|
565
565
|
**src/services/chat.service.ts**
|
|
566
566
|
|
|
567
567
|
```typescript
|
|
568
|
-
import { Service } from "fragment";
|
|
569
|
-
import { AIModule } from "fragment";
|
|
568
|
+
import { Service } from "fragment-ts";
|
|
569
|
+
import { AIModule } from "fragment-ts";
|
|
570
570
|
|
|
571
571
|
@Service()
|
|
572
572
|
export class ChatService {
|
|
@@ -624,7 +624,7 @@ export class ChatService {
|
|
|
624
624
|
**src/controllers/chat.controller.ts**
|
|
625
625
|
|
|
626
626
|
```typescript
|
|
627
|
-
import { Controller, Post, Body, Res } from "fragment";
|
|
627
|
+
import { Controller, Post, Body, Res } from "fragment-ts";
|
|
628
628
|
import { ChatService } from "../services/chat.service";
|
|
629
629
|
import { Response } from "express";
|
|
630
630
|
|
|
@@ -696,7 +696,7 @@ curl -X POST http://localhost:3000/chat/embeddings \
|
|
|
696
696
|
|
|
697
697
|
```typescript
|
|
698
698
|
// src/services/email.service.ts
|
|
699
|
-
import { Service } from "fragment";
|
|
699
|
+
import { Service } from "fragment-ts";
|
|
700
700
|
|
|
701
701
|
@Service()
|
|
702
702
|
export class EmailService {
|
|
@@ -708,7 +708,7 @@ export class EmailService {
|
|
|
708
708
|
}
|
|
709
709
|
|
|
710
710
|
// src/services/notification.service.ts
|
|
711
|
-
import { Service, Autowired } from "fragment";
|
|
711
|
+
import { Service, Autowired } from "fragment-ts";
|
|
712
712
|
import { EmailService } from "./email.service";
|
|
713
713
|
|
|
714
714
|
@Service()
|
|
@@ -728,7 +728,7 @@ export class NotificationService {
|
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
// src/services/order.service.ts
|
|
731
|
-
import { Service } from "fragment";
|
|
731
|
+
import { Service } from "fragment-ts";
|
|
732
732
|
import { NotificationService } from "./notification.service";
|
|
733
733
|
import { ProductRepository } from "../repositories/product.repository";
|
|
734
734
|
|
|
@@ -780,7 +780,7 @@ import {
|
|
|
780
780
|
Body,
|
|
781
781
|
Req,
|
|
782
782
|
Res,
|
|
783
|
-
} from "fragment";
|
|
783
|
+
} from "fragment-ts";
|
|
784
784
|
import { Request, Response } from "express";
|
|
785
785
|
|
|
786
786
|
@Controller("/api/v1/users")
|
|
@@ -863,7 +863,7 @@ export class LoggerMiddleware {
|
|
|
863
863
|
|
|
864
864
|
// src/main.ts
|
|
865
865
|
import "reflect-metadata";
|
|
866
|
-
import { FragmentApplication, FragmentWebApplication } from "fragment";
|
|
866
|
+
import { FragmentApplication, FragmentWebApplication } from "fragment-ts";
|
|
867
867
|
import { LoggerMiddleware } from "./middlewares/logger.middleware";
|
|
868
868
|
|
|
869
869
|
@FragmentApplication({
|
|
@@ -900,8 +900,8 @@ fragment generate controller users
|
|
|
900
900
|
**test/users.spec.ts**
|
|
901
901
|
|
|
902
902
|
```typescript
|
|
903
|
-
import { describe, it, expect } from "fragment";
|
|
904
|
-
import { DIContainer } from "fragment";
|
|
903
|
+
import { describe, it, expect } from "fragment-ts";
|
|
904
|
+
import { DIContainer } from "fragment-ts";
|
|
905
905
|
import { UserService } from "../src/services/user.service";
|
|
906
906
|
|
|
907
907
|
describe("UserService", () => {
|