@hedhog/blog 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/dist/author/author.controller.d.ts +14 -0
  2. package/dist/author/author.controller.d.ts.map +1 -0
  3. package/dist/author/author.controller.js +89 -0
  4. package/dist/author/author.controller.js.map +1 -0
  5. package/dist/author/author.module.d.ts +3 -0
  6. package/dist/author/author.module.d.ts.map +1 -0
  7. package/dist/author/author.module.js +31 -0
  8. package/dist/author/author.module.js.map +1 -0
  9. package/dist/author/author.service.d.ts +19 -0
  10. package/dist/author/author.service.d.ts.map +1 -0
  11. package/dist/author/author.service.js +72 -0
  12. package/dist/author/author.service.js.map +1 -0
  13. package/dist/author/dto/create.dto.d.ts +5 -0
  14. package/dist/author/dto/create.dto.d.ts.map +1 -0
  15. package/dist/author/dto/create.dto.js +27 -0
  16. package/dist/author/dto/create.dto.js.map +1 -0
  17. package/dist/author/dto/delete.dto.d.ts +4 -0
  18. package/dist/author/dto/delete.dto.d.ts.map +1 -0
  19. package/dist/author/dto/delete.dto.js +23 -0
  20. package/dist/author/dto/delete.dto.js.map +1 -0
  21. package/dist/author/dto/update.dto.d.ts +6 -0
  22. package/dist/author/dto/update.dto.d.ts.map +1 -0
  23. package/dist/author/dto/update.dto.js +9 -0
  24. package/dist/author/dto/update.dto.js.map +1 -0
  25. package/dist/blog.module.d.ts +3 -0
  26. package/dist/blog.module.d.ts.map +1 -0
  27. package/dist/blog.module.js +35 -0
  28. package/dist/blog.module.js.map +1 -0
  29. package/dist/category/category.controller.d.ts +14 -0
  30. package/dist/category/category.controller.d.ts.map +1 -0
  31. package/dist/category/category.controller.js +91 -0
  32. package/dist/category/category.controller.js.map +1 -0
  33. package/dist/category/category.module.d.ts +3 -0
  34. package/dist/category/category.module.d.ts.map +1 -0
  35. package/dist/category/category.module.js +31 -0
  36. package/dist/category/category.module.js.map +1 -0
  37. package/dist/category/category.service.d.ts +19 -0
  38. package/dist/category/category.service.d.ts.map +1 -0
  39. package/dist/category/category.service.js +87 -0
  40. package/dist/category/category.service.js.map +1 -0
  41. package/dist/category/dto/create.dto.d.ts +5 -0
  42. package/dist/category/dto/create.dto.d.ts.map +1 -0
  43. package/dist/category/dto/create.dto.js +23 -0
  44. package/dist/category/dto/create.dto.js.map +1 -0
  45. package/dist/category/dto/delete.dto.d.ts +4 -0
  46. package/dist/category/dto/delete.dto.d.ts.map +1 -0
  47. package/dist/category/dto/delete.dto.js +23 -0
  48. package/dist/category/dto/delete.dto.js.map +1 -0
  49. package/dist/category/dto/update.dto.d.ts +6 -0
  50. package/dist/category/dto/update.dto.d.ts.map +1 -0
  51. package/dist/category/dto/update.dto.js +9 -0
  52. package/dist/category/dto/update.dto.js.map +1 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +18 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/post/dto/create.dto.d.ts +5 -0
  58. package/dist/post/dto/create.dto.d.ts.map +1 -0
  59. package/dist/post/dto/create.dto.js +26 -0
  60. package/dist/post/dto/create.dto.js.map +1 -0
  61. package/dist/post/dto/delete.dto.d.ts +4 -0
  62. package/dist/post/dto/delete.dto.d.ts.map +1 -0
  63. package/dist/post/dto/delete.dto.js +23 -0
  64. package/dist/post/dto/delete.dto.js.map +1 -0
  65. package/dist/post/dto/update.dto.d.ts +6 -0
  66. package/dist/post/dto/update.dto.d.ts.map +1 -0
  67. package/dist/post/dto/update.dto.js +9 -0
  68. package/dist/post/dto/update.dto.js.map +1 -0
  69. package/dist/post/post.controller.d.ts +14 -0
  70. package/dist/post/post.controller.d.ts.map +1 -0
  71. package/dist/post/post.controller.js +89 -0
  72. package/dist/post/post.controller.js.map +1 -0
  73. package/dist/post/post.module.d.ts +3 -0
  74. package/dist/post/post.module.d.ts.map +1 -0
  75. package/dist/post/post.module.js +31 -0
  76. package/dist/post/post.module.js.map +1 -0
  77. package/dist/post/post.service.d.ts +19 -0
  78. package/dist/post/post.service.d.ts.map +1 -0
  79. package/dist/post/post.service.js +72 -0
  80. package/dist/post/post.service.js.map +1 -0
  81. package/frontend/author/components/create-panel.d.ts +9 -0
  82. package/frontend/author/components/create-panel.d.ts.map +1 -0
  83. package/frontend/author/components/create-panel.js +42 -0
  84. package/frontend/author/components/create-panel.js.map +1 -0
  85. package/frontend/author/components/create-panel.tsx +60 -0
  86. package/frontend/author/components/update-panel.d.ts +7 -0
  87. package/frontend/author/components/update-panel.d.ts.map +1 -0
  88. package/frontend/author/components/update-panel.js +52 -0
  89. package/frontend/author/components/update-panel.js.map +1 -0
  90. package/frontend/author/components/update-panel.tsx +70 -0
  91. package/frontend/author/react-query/handlers.d.ts +5 -0
  92. package/frontend/author/react-query/handlers.d.ts.map +1 -0
  93. package/frontend/author/react-query/handlers.js +30 -0
  94. package/frontend/author/react-query/handlers.js.map +1 -0
  95. package/frontend/author/react-query/handlers.ts +28 -0
  96. package/frontend/author/react-query/requests.d.ts +10 -0
  97. package/frontend/author/react-query/requests.d.ts.map +1 -0
  98. package/frontend/author/react-query/requests.js +48 -0
  99. package/frontend/author/react-query/requests.js.map +1 -0
  100. package/frontend/author/react-query/requests.ts +53 -0
  101. package/frontend/category/components/create-panel.d.ts +9 -0
  102. package/frontend/category/components/create-panel.d.ts.map +1 -0
  103. package/frontend/category/components/create-panel.js +48 -0
  104. package/frontend/category/components/create-panel.js.map +1 -0
  105. package/frontend/category/components/create-panel.tsx +49 -0
  106. package/frontend/category/components/update-panel.d.ts +7 -0
  107. package/frontend/category/components/update-panel.d.ts.map +1 -0
  108. package/frontend/category/components/update-panel.js +61 -0
  109. package/frontend/category/components/update-panel.js.map +1 -0
  110. package/frontend/category/components/update-panel.tsx +59 -0
  111. package/frontend/category/react-query/handlers.d.ts +5 -0
  112. package/frontend/category/react-query/handlers.d.ts.map +1 -0
  113. package/frontend/category/react-query/handlers.js +30 -0
  114. package/frontend/category/react-query/handlers.js.map +1 -0
  115. package/frontend/category/react-query/handlers.ts +28 -0
  116. package/frontend/category/react-query/requests.d.ts +10 -0
  117. package/frontend/category/react-query/requests.d.ts.map +1 -0
  118. package/frontend/category/react-query/requests.js +49 -0
  119. package/frontend/category/react-query/requests.js.map +1 -0
  120. package/frontend/category/react-query/requests.ts +54 -0
  121. package/frontend/post/components/create-panel.d.ts +9 -0
  122. package/frontend/post/components/create-panel.d.ts.map +1 -0
  123. package/frontend/post/components/create-panel.js +54 -0
  124. package/frontend/post/components/create-panel.js.map +1 -0
  125. package/frontend/post/components/create-panel.tsx +74 -0
  126. package/frontend/post/components/update-panel.d.ts +7 -0
  127. package/frontend/post/components/update-panel.d.ts.map +1 -0
  128. package/frontend/post/components/update-panel.js +64 -0
  129. package/frontend/post/components/update-panel.js.map +1 -0
  130. package/frontend/post/components/update-panel.tsx +84 -0
  131. package/frontend/post/react-query/handlers.d.ts +5 -0
  132. package/frontend/post/react-query/handlers.d.ts.map +1 -0
  133. package/frontend/post/react-query/handlers.js +30 -0
  134. package/frontend/post/react-query/handlers.js.map +1 -0
  135. package/frontend/post/react-query/handlers.ts +28 -0
  136. package/frontend/post/react-query/requests.d.ts +10 -0
  137. package/frontend/post/react-query/requests.d.ts.map +1 -0
  138. package/frontend/post/react-query/requests.js +48 -0
  139. package/frontend/post/react-query/requests.js.map +1 -0
  140. package/frontend/post/react-query/requests.ts +53 -0
  141. package/hedhog.yaml +133 -0
  142. package/package.json +35 -0
@@ -0,0 +1,10 @@
1
+ import { PaginationParams } from "@/types";
2
+ import { Post } from "@/types/models";
3
+ export declare function requests(): {
4
+ postCreate: (data: Post) => Promise<any>;
5
+ postUpdate: (id: number, data: Post) => Promise<any>;
6
+ postDelete: (ids: number[]) => Promise<any>;
7
+ postList: (params: PaginationParams) => Promise<any>;
8
+ postGet: (id: number) => Promise<any>;
9
+ };
10
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,wBAAgB,QAAQ;uBAgBU,IAAI;qBAgBN,MAAM,QAAQ,IAAI;sBARjB,MAAM,EAAE;uBArBP,gBAAgB;kBAOrB,MAAM;EAqClC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requests = requests;
4
+ const use_app_1 = require("@/hooks/use-app");
5
+ const http_method_1 = require("@/types/http-method");
6
+ function requests() {
7
+ const { request } = (0, use_app_1.useApp)();
8
+ const postList = async (params) => {
9
+ return request({
10
+ url: "/post",
11
+ params,
12
+ });
13
+ };
14
+ const postGet = async (id) => {
15
+ return request({
16
+ url: `/post/${id}`,
17
+ });
18
+ };
19
+ const postCreate = async (data) => {
20
+ return request({
21
+ url: "/post",
22
+ method: http_method_1.HttpMethod.POST,
23
+ data: data,
24
+ });
25
+ };
26
+ const postDelete = async (ids) => {
27
+ return request({
28
+ url: "/post",
29
+ data: { ids },
30
+ method: http_method_1.HttpMethod.DELETE,
31
+ });
32
+ };
33
+ const postUpdate = async (id, data) => {
34
+ return request({
35
+ url: `/post/${id}`,
36
+ method: http_method_1.HttpMethod.PATCH,
37
+ data: data,
38
+ });
39
+ };
40
+ return {
41
+ postCreate,
42
+ postUpdate,
43
+ postDelete,
44
+ postList,
45
+ postGet,
46
+ };
47
+ }
48
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":";;AAKA,4BA+CC;AApDD,6CAAyC;AAGzC,qDAAiD;AAEjD,SAAgB,QAAQ;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAC;IAE7B,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAwB,EAAE,EAAE;QAClD,OAAO,OAAO,CAAyB;YACrC,GAAG,EAAE,OAAO;YACZ,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;QACnC,OAAO,OAAO,CAAO;YACnB,GAAG,EAAE,SAAS,EAAE,EAAE;SACnB,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,EAAE,IAAU,EAAE,EAAE;QACtC,OAAO,OAAO,CAAO;YACnB,GAAG,EAAE,OAAO;YACZ,MAAM,EAAE,wBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,EAAE,GAAa,EAAE,EAAE;QACzC,OAAO,OAAO,CAAS;YACrB,GAAG,EAAE,OAAO;YACZ,IAAI,EAAE,EAAE,GAAG,EAAE;YACb,MAAM,EAAE,wBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,KAAK,EAAE,EAAU,EAAE,IAAU,EAAE,EAAE;QAClD,OAAO,OAAO,CAAO;YACnB,GAAG,EAAE,SAAS,EAAE,EAAE;YAClB,MAAM,EAAE,wBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,UAAU;QACV,UAAU;QACV,UAAU;QACV,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { useApp } from "@/hooks/use-app";
2
+ import { Delete, PaginationParams, PaginationResult } from "@/types";
3
+ import { Post } from "@/types/models";
4
+ import { HttpMethod } from "@/types/http-method";
5
+
6
+ export function requests() {
7
+ const { request } = useApp();
8
+
9
+ const postList = async (params: PaginationParams) => {
10
+ return request<PaginationResult<Post>>({
11
+ url: "/post",
12
+ params,
13
+ });
14
+ };
15
+
16
+ const postGet = async (id: number) => {
17
+ return request<Post>({
18
+ url: `/post/${id}`,
19
+ });
20
+ };
21
+
22
+ const postCreate = async (data: Post) => {
23
+ return request<Post>({
24
+ url: "/post",
25
+ method: HttpMethod.POST,
26
+ data: data,
27
+ });
28
+ };
29
+
30
+ const postDelete = async (ids: number[]) => {
31
+ return request<Delete>({
32
+ url: "/post",
33
+ data: { ids },
34
+ method: HttpMethod.DELETE,
35
+ });
36
+ };
37
+
38
+ const postUpdate = async (id: number, data: Post) => {
39
+ return request<Post>({
40
+ url: `/post/${id}`,
41
+ method: HttpMethod.PATCH,
42
+ data: data,
43
+ });
44
+ };
45
+
46
+ return {
47
+ postCreate,
48
+ postUpdate,
49
+ postDelete,
50
+ postList,
51
+ postGet,
52
+ };
53
+ }
package/hedhog.yaml ADDED
@@ -0,0 +1,133 @@
1
+ data:
2
+ route:
3
+ - url: /auth/login
4
+ method: POST
5
+ - url: /post
6
+ method: GET
7
+ - url: /post/:id
8
+ method: GET
9
+ - url: /author
10
+ method: GET
11
+ relations: &a1
12
+ role:
13
+ - where:
14
+ slug: admin
15
+ - url: /author/:id
16
+ method: GET
17
+ relations: *a1
18
+ - url: /category
19
+ method: GET
20
+ relations: &a2
21
+ role:
22
+ - where:
23
+ slug: admin
24
+ - url: /category/:id
25
+ method: GET
26
+ relations: *a2
27
+ menu:
28
+ - name:
29
+ en: Author
30
+ pt: Author
31
+ icon: file
32
+ url: /author
33
+ slug: author
34
+ relations: *a1
35
+ - name:
36
+ en: Category
37
+ pt: Category
38
+ icon: file
39
+ url: /category
40
+ slug: category
41
+ relations: *a2
42
+ - name:
43
+ en: Post
44
+ pt: Post
45
+ icon: file
46
+ url: /post
47
+ slug: post
48
+ relations:
49
+ role:
50
+ - where:
51
+ slug: admin
52
+ screen:
53
+ - name:
54
+ en: Author
55
+ pt: Author
56
+ slug: author
57
+ description:
58
+ en: Screen to manage author
59
+ pt: Tela para gerenciar author
60
+ icon: file
61
+ - name:
62
+ en: Category
63
+ pt: Category
64
+ slug: category
65
+ description:
66
+ en: Screen to manage category
67
+ pt: Tela para gerenciar category
68
+ icon: file
69
+ - name:
70
+ en: Post
71
+ pt: Post
72
+ slug: post
73
+ description:
74
+ en: Screen to manage post
75
+ pt: Tela para gerenciar post
76
+ icon: file
77
+ tables:
78
+ author:
79
+ columns:
80
+ - type: pk
81
+ - name: name
82
+ - name: email
83
+ ifNotExists: true
84
+ category:
85
+ columns:
86
+ - type: pk
87
+ - type: slug
88
+ - type: created_at
89
+ - type: updated_at
90
+ ifNotExists: true
91
+ category_locale:
92
+ columns:
93
+ - name: category_id
94
+ type: fk
95
+ isPrimary: true
96
+ references:
97
+ table: category
98
+ column: id
99
+ onDelete: RESTRICT
100
+ - name: locale_id
101
+ type: fk
102
+ isPrimary: true
103
+ references:
104
+ table: locale
105
+ column: id
106
+ onDelete: RESTRICT
107
+ - name: name
108
+ length: 100
109
+ - name: description
110
+ length: 512
111
+ - type: created_at
112
+ - type: updated_at
113
+ post:
114
+ columns:
115
+ - type: pk
116
+ - name: title
117
+ - name: content
118
+ type: text
119
+ - name: author_id
120
+ type: fk
121
+ references:
122
+ table: author
123
+ column: id
124
+ onDelete: CASCADE
125
+ - name: category_id
126
+ type: fk
127
+ references:
128
+ table: category
129
+ column: id
130
+ onDelete: RESTRICT
131
+ - type: created_at
132
+ - type: updated_at
133
+ ifNotExists: true
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@hedhog/blog",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "clean": "rimraf ./dist",
8
+ "prebuild": "npm run clean",
9
+ "build": "tsc --project tsconfig.production.json && npm version patch",
10
+ "prod": "npm run build && npm publish --access public"
11
+ },
12
+ "files": [
13
+ "dist/**/*",
14
+ "frontend/**/*",
15
+ "src/entities/**/*.ts",
16
+ "src/migrations/**/*.ts",
17
+ "src/**/*.ejs",
18
+ "hedhog.yaml"
19
+ ],
20
+ "keywords": [],
21
+ "author": "",
22
+ "license": "MIT",
23
+ "description": "",
24
+ "peerDependencies": {
25
+ "@hedhog/admin": "latest",
26
+ "@hedhog/pagination": "latest",
27
+ "@hedhog/prisma": "latest"
28
+ },
29
+ "devDependencies": {
30
+ "@hedhog/admin": "^0.0.108",
31
+ "@hedhog/pagination": "^0.0.17",
32
+ "@hedhog/prisma": "^0.0.11",
33
+ "@nestjs/mapped-types": "^2.0.5"
34
+ }
35
+ }