@finesoft/create-app 0.1.26 → 0.1.27
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/templates/react/package.json +1 -1
- package/templates/react/src/bootstrap.ts +4 -4
- package/templates/react/src/lib/controllers/product-detail.ts +5 -5
- package/templates/react-minimal/package.json +1 -1
- package/templates/svelte/package.json +1 -1
- package/templates/svelte/src/bootstrap.ts +4 -4
- package/templates/svelte/src/lib/controllers/product-detail.ts +5 -5
- package/templates/svelte-minimal/package.json +1 -1
- package/templates/vue/package.json +1 -1
- package/templates/vue/src/bootstrap.ts +4 -4
- package/templates/vue/src/lib/controllers/product-detail.ts +5 -5
- package/templates/vue-minimal/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Framework, defineRoutes } from "@finesoft/front";
|
|
1
|
+
import { type Framework, defineRoutes, int, route } from "@finesoft/front";
|
|
2
2
|
import { AboutController } from "./lib/controllers/about";
|
|
3
3
|
import { HomeController } from "./lib/controllers/home";
|
|
4
4
|
import { ProductDetailController } from "./lib/controllers/product-detail";
|
|
@@ -11,11 +11,11 @@ export function bootstrap(framework: Framework): void {
|
|
|
11
11
|
|
|
12
12
|
defineRoutes(framework, [
|
|
13
13
|
{ path: "/", intentId: "home", controller: new HomeController() },
|
|
14
|
-
{
|
|
15
|
-
path: "/products/:id",
|
|
14
|
+
route("/products/:id", {
|
|
16
15
|
intentId: "product-detail",
|
|
17
16
|
controller: new ProductDetailController(),
|
|
18
|
-
|
|
17
|
+
params: { id: int() },
|
|
18
|
+
}),
|
|
19
19
|
{
|
|
20
20
|
path: "/search",
|
|
21
21
|
intentId: "search",
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "@finesoft/front";
|
|
8
8
|
import type { ProductPage } from "../models/product";
|
|
9
9
|
|
|
10
|
-
export class ProductDetailController extends BaseController<{ id:
|
|
10
|
+
export class ProductDetailController extends BaseController<{ id: number }, ProductPage> {
|
|
11
11
|
readonly intentId = "product-detail";
|
|
12
12
|
|
|
13
|
-
async execute(params: { id:
|
|
13
|
+
async execute(params: { id: number }, container: Container): Promise<ProductPage> {
|
|
14
14
|
const loggerFactory = container.resolve<LoggerFactory>(DEP_KEYS.LOGGER_FACTORY);
|
|
15
15
|
const log: Logger = loggerFactory.loggerFor("ProductDetailController");
|
|
16
16
|
log.info(`Loading product ${params.id}`);
|
|
@@ -23,7 +23,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
23
23
|
description: `Details for product ${params.id}`,
|
|
24
24
|
url: `/products/${params.id}`,
|
|
25
25
|
product: {
|
|
26
|
-
id: params.id,
|
|
26
|
+
id: String(params.id),
|
|
27
27
|
name: `Product ${params.id}`,
|
|
28
28
|
price: 29.99,
|
|
29
29
|
description:
|
|
@@ -33,7 +33,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
fallback(params: { id:
|
|
36
|
+
fallback(params: { id: number }, error: Error): ProductPage {
|
|
37
37
|
return {
|
|
38
38
|
id: `product-${params.id}`,
|
|
39
39
|
pageType: "product",
|
|
@@ -41,7 +41,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
41
41
|
description: error.message,
|
|
42
42
|
url: `/products/${params.id}`,
|
|
43
43
|
product: {
|
|
44
|
-
id: params.id,
|
|
44
|
+
id: String(params.id),
|
|
45
45
|
name: "Unknown Product",
|
|
46
46
|
price: 0,
|
|
47
47
|
description: "Could not load product data.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Framework, defineRoutes } from "@finesoft/front";
|
|
1
|
+
import { type Framework, defineRoutes, int, route } from "@finesoft/front";
|
|
2
2
|
import { AboutController } from "./lib/controllers/about";
|
|
3
3
|
import { HomeController } from "./lib/controllers/home";
|
|
4
4
|
import { ProductDetailController } from "./lib/controllers/product-detail";
|
|
@@ -11,11 +11,11 @@ export function bootstrap(framework: Framework): void {
|
|
|
11
11
|
|
|
12
12
|
defineRoutes(framework, [
|
|
13
13
|
{ path: "/", intentId: "home", controller: new HomeController() },
|
|
14
|
-
{
|
|
15
|
-
path: "/products/:id",
|
|
14
|
+
route("/products/:id", {
|
|
16
15
|
intentId: "product-detail",
|
|
17
16
|
controller: new ProductDetailController(),
|
|
18
|
-
|
|
17
|
+
params: { id: int() },
|
|
18
|
+
}),
|
|
19
19
|
{
|
|
20
20
|
path: "/search",
|
|
21
21
|
intentId: "search",
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "@finesoft/front";
|
|
8
8
|
import type { ProductPage } from "../models/product";
|
|
9
9
|
|
|
10
|
-
export class ProductDetailController extends BaseController<{ id:
|
|
10
|
+
export class ProductDetailController extends BaseController<{ id: number }, ProductPage> {
|
|
11
11
|
readonly intentId = "product-detail";
|
|
12
12
|
|
|
13
|
-
async execute(params: { id:
|
|
13
|
+
async execute(params: { id: number }, container: Container): Promise<ProductPage> {
|
|
14
14
|
const loggerFactory = container.resolve<LoggerFactory>(DEP_KEYS.LOGGER_FACTORY);
|
|
15
15
|
const log: Logger = loggerFactory.loggerFor("ProductDetailController");
|
|
16
16
|
log.info(`Loading product ${params.id}`);
|
|
@@ -23,7 +23,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
23
23
|
title: `Product ${params.id}`,
|
|
24
24
|
description: `Details for product ${params.id}`,
|
|
25
25
|
product: {
|
|
26
|
-
id: params.id,
|
|
26
|
+
id: String(params.id),
|
|
27
27
|
name: `Product ${params.id}`,
|
|
28
28
|
price: 29.99,
|
|
29
29
|
description:
|
|
@@ -33,7 +33,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
fallback(params: { id:
|
|
36
|
+
fallback(params: { id: number }, error: Error): ProductPage {
|
|
37
37
|
return {
|
|
38
38
|
id: `product-${params.id}`,
|
|
39
39
|
pageType: "product",
|
|
@@ -41,7 +41,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
41
41
|
title: "Product Not Found",
|
|
42
42
|
description: error.message,
|
|
43
43
|
product: {
|
|
44
|
-
id: params.id,
|
|
44
|
+
id: String(params.id),
|
|
45
45
|
name: "Unknown Product",
|
|
46
46
|
price: 0,
|
|
47
47
|
description: "Could not load product data.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Framework, defineRoutes } from "@finesoft/front";
|
|
1
|
+
import { type Framework, defineRoutes, int, route } from "@finesoft/front";
|
|
2
2
|
import { AboutController } from "./lib/controllers/about";
|
|
3
3
|
import { HomeController } from "./lib/controllers/home";
|
|
4
4
|
import { ProductDetailController } from "./lib/controllers/product-detail";
|
|
@@ -13,11 +13,11 @@ export function bootstrap(framework: Framework): void {
|
|
|
13
13
|
defineRoutes(framework, [
|
|
14
14
|
// SSR routes (default)
|
|
15
15
|
{ path: "/", intentId: "home", controller: new HomeController() },
|
|
16
|
-
{
|
|
17
|
-
path: "/products/:id",
|
|
16
|
+
route("/products/:id", {
|
|
18
17
|
intentId: "product-detail",
|
|
19
18
|
controller: new ProductDetailController(),
|
|
20
|
-
|
|
19
|
+
params: { id: int() },
|
|
20
|
+
}),
|
|
21
21
|
{
|
|
22
22
|
path: "/search",
|
|
23
23
|
intentId: "search",
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "@finesoft/front";
|
|
8
8
|
import type { ProductPage } from "../models/product";
|
|
9
9
|
|
|
10
|
-
export class ProductDetailController extends BaseController<{ id:
|
|
10
|
+
export class ProductDetailController extends BaseController<{ id: number }, ProductPage> {
|
|
11
11
|
readonly intentId = "product-detail";
|
|
12
12
|
|
|
13
|
-
async execute(params: { id:
|
|
13
|
+
async execute(params: { id: number }, container: Container): Promise<ProductPage> {
|
|
14
14
|
const loggerFactory = container.resolve<LoggerFactory>(DEP_KEYS.LOGGER_FACTORY);
|
|
15
15
|
const log: Logger = loggerFactory.loggerFor("ProductDetailController");
|
|
16
16
|
log.info(`Loading product ${params.id}`);
|
|
@@ -23,7 +23,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
23
23
|
title: `Product ${params.id}`,
|
|
24
24
|
description: `Details for product ${params.id}`,
|
|
25
25
|
product: {
|
|
26
|
-
id: params.id,
|
|
26
|
+
id: String(params.id),
|
|
27
27
|
name: `Product ${params.id}`,
|
|
28
28
|
price: 29.99,
|
|
29
29
|
description:
|
|
@@ -33,7 +33,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
fallback(params: { id:
|
|
36
|
+
fallback(params: { id: number }, error: Error): ProductPage {
|
|
37
37
|
return {
|
|
38
38
|
id: `product-${params.id}`,
|
|
39
39
|
pageType: "product",
|
|
@@ -41,7 +41,7 @@ export class ProductDetailController extends BaseController<{ id: string }, Prod
|
|
|
41
41
|
title: "Product Not Found",
|
|
42
42
|
description: error.message,
|
|
43
43
|
product: {
|
|
44
|
-
id: params.id,
|
|
44
|
+
id: String(params.id),
|
|
45
45
|
name: "Unknown Product",
|
|
46
46
|
price: 0,
|
|
47
47
|
description: "Could not load product data.",
|