netcore-blueprint 1.0.24 → 1.0.26

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 (30) hide show
  1. package/BlueprintTemplate/Blueprint.API/{Controllers → AsyncControllers}/UserControllerAsync.cs +2 -2
  2. package/BlueprintTemplate/Blueprint.API/Blueprint.API.csproj +0 -1
  3. package/BlueprintTemplate/Blueprint.API/Controllers/UserController.cs +2 -1
  4. package/BlueprintTemplate/Blueprint.API/Program.cs +2 -1
  5. package/BlueprintTemplate/Blueprint.API/appsettings.json +1 -1
  6. package/BlueprintTemplate/Blueprint.Core/Blueprint.Core.csproj +1 -0
  7. package/BlueprintTemplate/Blueprint.Core/Dtos/Requests/BaseRequestDto.cs +7 -7
  8. package/BlueprintTemplate/Blueprint.Core/Dtos/Requests/UserRequestDto.cs +2 -4
  9. package/BlueprintTemplate/Blueprint.Core/Dtos/Responses/BaseResponseDto.cs +8 -11
  10. package/BlueprintTemplate/Blueprint.Core/Dtos/Responses/UserResponseDto.cs +1 -2
  11. package/BlueprintTemplate/Blueprint.Core/Entities/BaseEntity.cs +6 -6
  12. package/BlueprintTemplate/Blueprint.Core/Entities/Category.cs +3 -1
  13. package/BlueprintTemplate/Blueprint.Core/Entities/Product.cs +4 -5
  14. package/BlueprintTemplate/Blueprint.Core/Interfaces/SPI/IRepositoryFactory.cs +0 -1
  15. package/BlueprintTemplate/Blueprint.Core/Interfaces/SPI/IUserInfra.cs +2 -2
  16. package/BlueprintTemplate/Blueprint.Infra/Blueprint.Infra.csproj +4 -1
  17. package/BlueprintTemplate/Blueprint.Infra/Database/DbInitializer.cs +63 -63
  18. package/BlueprintTemplate/Blueprint.Infra/Migrations/{20250401143459_InitialCreate.Designer.cs → 20250405235602_InitialCreate.Designer.cs} +98 -89
  19. package/BlueprintTemplate/Blueprint.Infra/Migrations/20250405235602_InitialCreate.cs +154 -0
  20. package/BlueprintTemplate/Blueprint.Infra/Migrations/MyDbContextModelSnapshot.cs +97 -88
  21. package/BlueprintTemplate/Blueprint.Infra/Services/{MongoItemInfra.cs → Mongo/MongoItemInfra.cs} +3 -3
  22. package/BlueprintTemplate/Blueprint.Infra/Services/{MongoUserInfra.cs → Mongo/MongoUserInfra.cs} +2 -3
  23. package/BlueprintTemplate/Blueprint.Infra/Services/{MySQLItemInfra.cs → MySQL/MySQLItemInfra.cs} +3 -3
  24. package/BlueprintTemplate/Blueprint.Infra/Services/{MySQLUserInfra.cs → MySQL/MySQLUserInfra.cs} +2 -3
  25. package/BlueprintTemplate/Blueprint.Infra/Services/RepositoryFactory.cs +14 -10
  26. package/package.json +1 -1
  27. package/BlueprintTemplate/Blueprint.API/Controllers/WeatherForecastController.cs +0 -33
  28. package/BlueprintTemplate/Blueprint.Core/Dtos/Others/BaseDto.cs +0 -10
  29. package/BlueprintTemplate/Blueprint.Infra/Migrations/20250401143459_InitialCreate.cs +0 -149
  30. /package/BlueprintTemplate/{Blueprint.Infra → Blueprint.Core}/Services/RabbitMqService.cs +0 -0
@@ -30,21 +30,27 @@ namespace Blueprint.Infra.Migrations
30
30
 
31
31
  MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
32
32
 
33
- b.Property<bool>("Active")
34
- .HasColumnType("tinyint(1)");
35
-
36
- b.Property<DateTime>("CreatedDate")
37
- .HasColumnType("datetime(6)");
33
+ b.Property<string>("Content")
34
+ .HasColumnType("longtext");
38
35
 
39
- b.Property<string>("Description")
36
+ b.Property<string>("CoverImage")
40
37
  .HasColumnType("longtext");
41
38
 
42
- b.Property<DateTime>("LastModifiedDate")
39
+ b.Property<DateTime>("Date")
40
+ .HasColumnType("datetime(6)");
41
+
42
+ b.Property<DateTime>("Modified")
43
43
  .HasColumnType("datetime(6)");
44
44
 
45
45
  b.Property<string>("Name")
46
46
  .HasColumnType("longtext");
47
47
 
48
+ b.Property<bool>("Status")
49
+ .HasColumnType("tinyint(1)");
50
+
51
+ b.Property<string>("Title")
52
+ .HasColumnType("longtext");
53
+
48
54
  b.HasKey("Id");
49
55
 
50
56
  b.ToTable("Category");
@@ -53,18 +59,18 @@ namespace Blueprint.Infra.Migrations
53
59
  new
54
60
  {
55
61
  Id = 1,
56
- Active = true,
57
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3948),
58
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3948),
59
- Name = "Item 1"
62
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6934),
63
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6935),
64
+ Name = "Item 1",
65
+ Status = true
60
66
  },
61
67
  new
62
68
  {
63
69
  Id = 2,
64
- Active = true,
65
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3950),
66
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3950),
67
- Name = "Item 2"
70
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6937),
71
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6937),
72
+ Name = "Item 2",
73
+ Status = true
68
74
  });
69
75
  });
70
76
 
@@ -76,25 +82,28 @@ namespace Blueprint.Infra.Migrations
76
82
 
77
83
  MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
78
84
 
79
- b.Property<bool>("Active")
80
- .HasColumnType("tinyint(1)");
81
-
82
85
  b.Property<int?>("CategoryId")
83
86
  .HasColumnType("int");
84
87
 
85
- b.Property<DateTime>("CreatedDate")
86
- .HasColumnType("datetime(6)");
88
+ b.Property<string>("Content")
89
+ .HasColumnType("longtext");
87
90
 
88
- b.Property<string>("Description")
91
+ b.Property<string>("CoverImage")
89
92
  .HasColumnType("longtext");
90
93
 
91
- b.Property<DateTime>("LastModifiedDate")
94
+ b.Property<DateTime>("Date")
95
+ .HasColumnType("datetime(6)");
96
+
97
+ b.Property<DateTime>("Modified")
92
98
  .HasColumnType("datetime(6)");
93
99
 
94
100
  b.Property<string>("Name")
95
101
  .HasColumnType("longtext");
96
102
 
97
- b.Property<string>("Url")
103
+ b.Property<bool>("Status")
104
+ .HasColumnType("tinyint(1)");
105
+
106
+ b.Property<string>("Title")
98
107
  .HasColumnType("longtext");
99
108
 
100
109
  b.HasKey("Id");
@@ -107,122 +116,122 @@ namespace Blueprint.Infra.Migrations
107
116
  new
108
117
  {
109
118
  Id = 1,
110
- Active = true,
111
119
  CategoryId = 1,
112
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3965),
113
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3965),
120
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Premtilmiue.png",
121
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6954),
122
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6954),
114
123
  Name = "Item 1",
115
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Premtilmiue.png"
124
+ Status = true
116
125
  },
117
126
  new
118
127
  {
119
128
  Id = 2,
120
- Active = true,
121
129
  CategoryId = 2,
122
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3967),
123
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3968),
130
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Protile.png",
131
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6956),
132
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6957),
124
133
  Name = "Item 2",
125
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Protile.png"
134
+ Status = true
126
135
  },
127
136
  new
128
137
  {
129
138
  Id = 3,
130
- Active = true,
131
139
  CategoryId = 2,
132
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3969),
133
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3970),
140
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Supertile.png",
141
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6959),
142
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6959),
134
143
  Name = "Item 3",
135
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Supertile.png"
144
+ Status = true
136
145
  },
137
146
  new
138
147
  {
139
148
  Id = 4,
140
- Active = true,
141
149
  CategoryId = 1,
142
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3972),
143
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3972),
150
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-Sealant-HP.jpg",
151
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6961),
152
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6962),
144
153
  Name = "Item 4",
145
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-Sealant-HP.jpg"
154
+ Status = true
146
155
  },
147
156
  new
148
157
  {
149
158
  Id = 5,
150
- Active = true,
151
159
  CategoryId = 2,
152
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3974),
153
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3974),
160
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-.jpg",
161
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6964),
162
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6964),
154
163
  Name = "Item 5",
155
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-.jpg"
164
+ Status = true
156
165
  },
157
166
  new
158
167
  {
159
168
  Id = 6,
160
- Active = true,
161
169
  CategoryId = 2,
162
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3976),
163
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3976),
170
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-1.jpg",
171
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6966),
172
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6966),
164
173
  Name = "Item 6",
165
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-1.jpg"
174
+ Status = true
166
175
  },
167
176
  new
168
177
  {
169
178
  Id = 7,
170
- Active = true,
171
179
  CategoryId = 1,
172
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3978),
173
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3979),
180
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-303.jpg",
181
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6968),
182
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6969),
174
183
  Name = "Item 7",
175
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-303.jpg"
184
+ Status = true
176
185
  },
177
186
  new
178
187
  {
179
188
  Id = 8,
180
- Active = true,
181
189
  CategoryId = 2,
182
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3980),
183
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3981),
190
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Premtilmiue.png",
191
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6971),
192
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6971),
184
193
  Name = "Item 8",
185
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Premtilmiue.png"
194
+ Status = true
186
195
  },
187
196
  new
188
197
  {
189
198
  Id = 9,
190
- Active = true,
191
199
  CategoryId = 2,
192
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3982),
193
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3983),
200
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Protile.png",
201
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6973),
202
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6973),
194
203
  Name = "Item 9",
195
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Protile.png"
204
+ Status = true
196
205
  },
197
206
  new
198
207
  {
199
208
  Id = 10,
200
- Active = true,
201
209
  CategoryId = 1,
202
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3985),
203
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3985),
210
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Supertile.png",
211
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6975),
212
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6976),
204
213
  Name = "Item 10",
205
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/keo-dan-gach-TOA-Supertile.png"
214
+ Status = true
206
215
  },
207
216
  new
208
217
  {
209
218
  Id = 11,
210
- Active = true,
211
219
  CategoryId = 2,
212
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3987),
213
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3987),
220
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-Sealant-HP.jpg",
221
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6978),
222
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6978),
214
223
  Name = "Item 11",
215
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-Sealant-HP.jpg"
224
+ Status = true
216
225
  },
217
226
  new
218
227
  {
219
228
  Id = 12,
220
- Active = true,
221
229
  CategoryId = 2,
222
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3989),
223
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3989),
230
+ CoverImage = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-.jpg",
231
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6980),
232
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6980),
224
233
  Name = "Item 12",
225
- Url = "https://innocons.s3.ap-southeast-1.amazonaws.com/products/Silicone-TOA-.jpg"
234
+ Status = true
226
235
  });
227
236
  });
228
237
 
@@ -234,16 +243,13 @@ namespace Blueprint.Infra.Migrations
234
243
 
235
244
  MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
236
245
 
237
- b.Property<bool>("Active")
238
- .HasColumnType("tinyint(1)");
239
-
240
- b.Property<DateTime>("CreatedDate")
246
+ b.Property<DateTime>("Date")
241
247
  .HasColumnType("datetime(6)");
242
248
 
243
249
  b.Property<string>("Email")
244
250
  .HasColumnType("longtext");
245
251
 
246
- b.Property<DateTime>("LastModifiedDate")
252
+ b.Property<DateTime>("Modified")
247
253
  .HasColumnType("datetime(6)");
248
254
 
249
255
  b.Property<string>("Name")
@@ -255,6 +261,9 @@ namespace Blueprint.Infra.Migrations
255
261
  b.Property<int>("Role")
256
262
  .HasColumnType("int");
257
263
 
264
+ b.Property<bool>("Status")
265
+ .HasColumnType("tinyint(1)");
266
+
258
267
  b.HasKey("Id");
259
268
 
260
269
  b.ToTable("User");
@@ -263,32 +272,32 @@ namespace Blueprint.Infra.Migrations
263
272
  new
264
273
  {
265
274
  Id = 1,
266
- Active = true,
267
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3853),
275
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6827),
268
276
  Email = "",
269
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3854),
277
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6827),
270
278
  Name = "Test",
271
- Role = 0
279
+ Role = 0,
280
+ Status = true
272
281
  },
273
282
  new
274
283
  {
275
284
  Id = 2,
276
- Active = true,
277
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3856),
285
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6830),
278
286
  Email = "truongdxfx08031@funix.edu.vn",
279
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3857),
287
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6830),
280
288
  Name = "Truong Dang",
281
- Role = 0
289
+ Role = 0,
290
+ Status = true
282
291
  },
283
292
  new
284
293
  {
285
294
  Id = 3,
286
- Active = true,
287
- CreatedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3859),
295
+ Date = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6832),
288
296
  Email = "truonghusk17aws1@gmail.com",
289
- LastModifiedDate = new DateTime(2025, 4, 1, 21, 34, 58, 114, DateTimeKind.Local).AddTicks(3859),
297
+ Modified = new DateTime(2025, 4, 6, 6, 56, 0, 937, DateTimeKind.Local).AddTicks(6833),
290
298
  Name = "Thai Son",
291
- Role = 0
299
+ Role = 0,
300
+ Status = true
292
301
  });
293
302
  });
294
303
 
@@ -5,7 +5,7 @@ using Blueprint.Core.Models;
5
5
  using MongoDB.Driver;
6
6
  using System.Linq.Expressions;
7
7
 
8
- namespace Blueprint.Infra.Services
8
+ namespace Blueprint.Infra.Services.Mongo
9
9
  {
10
10
  public class MongoItemInfra<T> : IItemInfra<T> where T : BaseEntity
11
11
  {
@@ -13,7 +13,7 @@ namespace Blueprint.Infra.Services
13
13
  public readonly ILogger<MongoItemInfra<T>> _logger;
14
14
 
15
15
  public MongoItemInfra(
16
- IMongoDatabase database,
16
+ IMongoDatabase database,
17
17
  ILogger<MongoItemInfra<T>> logger)
18
18
  {
19
19
  _dbSet = database.GetCollection<T>(typeof(T).Name.ToLower());
@@ -98,7 +98,7 @@ namespace Blueprint.Infra.Services
98
98
  try
99
99
  {
100
100
  var id = typeof(T).GetProperty("Id")?.GetValue(item);
101
- if (id == null)
101
+ if (id == null)
102
102
  throw Errors.CannotFindTheItem;
103
103
 
104
104
  await _dbSet.ReplaceOneAsync(Builders<T>.Filter.Eq("Id", id), item);
@@ -1,16 +1,15 @@
1
1
  using Blueprint.Core.Entities;
2
2
  using Blueprint.Core.Errors;
3
3
  using Blueprint.Infra.Database;
4
- using Blueprint.Infra.Services;
5
4
  using Microsoft.EntityFrameworkCore;
6
5
  using MongoDB.Driver;
7
6
  using Template.Core.Interfaces.SPI;
8
7
 
9
- namespace Template.Infra.Services
8
+ namespace Blueprint.Infra.Services.Mongo
10
9
  {
11
10
  public class MongoUserInfra : MongoItemInfra<User>, IUserInfra
12
11
  {
13
- public MongoUserInfra(IMongoDatabase dbContext, ILogger<MongoUserInfra> logger)
12
+ public MongoUserInfra(IMongoDatabase dbContext, ILogger<MongoUserInfra> logger)
14
13
  : base(dbContext, logger)
15
14
  {
16
15
  }
@@ -6,7 +6,7 @@ using Blueprint.Core.Models;
6
6
  using Blueprint.Infra.Database;
7
7
  using System.Linq.Expressions;
8
8
 
9
- namespace Blueprint.Infra.Services
9
+ namespace Blueprint.Infra.Services.MySQL
10
10
  {
11
11
  public class MySQLItemInfra<T> : IItemInfra<T> where T : BaseEntity
12
12
  {
@@ -42,7 +42,7 @@ namespace Blueprint.Infra.Services
42
42
  try
43
43
  {
44
44
  List<T> items = _dbSet.Where(p => ids.Contains(p.Id)).ToList();
45
- items.ForEach(i => i.Active = false);
45
+ items.ForEach(i => i.Status = false);
46
46
  _dbSet.UpdateRange(items);
47
47
  await _dbContext.SaveChangesAsync();
48
48
  }
@@ -82,7 +82,7 @@ namespace Blueprint.Infra.Services
82
82
  {
83
83
  int skipValues = (pagingParams.Page - 1) * pagingParams.Per_Page;
84
84
  IQueryable<T> query = _dbSet
85
- .Where(p => p.Active == true)
85
+ .Where(p => p.Status == true)
86
86
  .OrderByDescending(p => p.Id);
87
87
 
88
88
  // Apply includes dynamically
@@ -1,15 +1,14 @@
1
1
  using Blueprint.Core.Entities;
2
2
  using Blueprint.Core.Errors;
3
3
  using Blueprint.Infra.Database;
4
- using Blueprint.Infra.Services;
5
4
  using Microsoft.EntityFrameworkCore;
6
5
  using Template.Core.Interfaces.SPI;
7
6
 
8
- namespace Template.Infra.Services
7
+ namespace Blueprint.Infra.Services.MySQL
9
8
  {
10
9
  public class MySQLUserInfra : MySQLItemInfra<User>, IUserInfra
11
10
  {
12
- public MySQLUserInfra(MyDbContext dbContext, ILogger<MySQLUserInfra> logger)
11
+ public MySQLUserInfra(MyDbContext dbContext, ILogger<MySQLUserInfra> logger)
13
12
  : base(dbContext, logger)
14
13
  {
15
14
  }
@@ -1,7 +1,7 @@
1
1
  using Blueprint.Core.Entities;
2
2
  using Blueprint.Core.Interfaces.SPI;
3
- using Template.Core.Interfaces.SPI;
4
- using Template.Infra.Services;
3
+ using Blueprint.Infra.Services.Mongo;
4
+ using Blueprint.Infra.Services.MySQL;
5
5
 
6
6
  namespace Blueprint.Infra.Services
7
7
  {
@@ -18,21 +18,25 @@ namespace Blueprint.Infra.Services
18
18
 
19
19
  public IItemInfra<T> CreateItemRepository()
20
20
  {
21
- return _databaseType.ToLower() switch
21
+ var dbType = _databaseType.ToLower();
22
+ var entityType = typeof(T);
23
+
24
+ Type implementationType = dbType switch
22
25
  {
23
- "mysql" => ActivatorUtilities.CreateInstance<MySQLItemInfra<T>>(_serviceProvider),
24
- "mongodb" => ActivatorUtilities.CreateInstance<MongoItemInfra<T>>(_serviceProvider),
26
+ "mysql" => GetMySqlImplementationType(entityType),
27
+ "mongodb" => typeof(MongoItemInfra<>).MakeGenericType(entityType),
25
28
  _ => throw new ArgumentException("Invalid database type")
26
29
  };
30
+
31
+ return (IItemInfra<T>)ActivatorUtilities.CreateInstance(_serviceProvider, implementationType);
27
32
  }
28
33
 
29
- public IUserInfra CreateUserRepository()
34
+ private Type GetMySqlImplementationType(Type entityType)
30
35
  {
31
- return _databaseType.ToLower() switch
36
+ return entityType.Name switch
32
37
  {
33
- "mysql" => ActivatorUtilities.CreateInstance<MySQLUserInfra>(_serviceProvider),
34
- "mongodb" => ActivatorUtilities.CreateInstance<MongoUserInfra>(_serviceProvider),
35
- _ => throw new ArgumentException("Invalid database type")
38
+ nameof(User) => typeof(MySQLUserInfra),
39
+ _ => typeof(MySQLItemInfra<>).MakeGenericType(entityType)
36
40
  };
37
41
  }
38
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "netcore-blueprint",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "A custom .NET Core project blueprint",
5
5
  "main": "create.js",
6
6
  "bin": {
@@ -1,33 +0,0 @@
1
- using Microsoft.AspNetCore.Mvc;
2
-
3
- namespace Blueprint.API.Controllers
4
- {
5
- [ApiController]
6
- [Route("[controller]")]
7
- public class WeatherForecastController : ControllerBase
8
- {
9
- private static readonly string[] Summaries = new[]
10
- {
11
- "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12
- };
13
-
14
- private readonly ILogger<WeatherForecastController> _logger;
15
-
16
- public WeatherForecastController(ILogger<WeatherForecastController> logger)
17
- {
18
- _logger = logger;
19
- }
20
-
21
- [HttpGet(Name = "GetWeatherForecast")]
22
- public IEnumerable<WeatherForecast> Get()
23
- {
24
- return Enumerable.Range(1, 5).Select(index => new WeatherForecast
25
- {
26
- Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
27
- TemperatureC = Random.Shared.Next(-20, 55),
28
- Summary = Summaries[Random.Shared.Next(Summaries.Length)]
29
- })
30
- .ToArray();
31
- }
32
- }
33
- }
@@ -1,10 +0,0 @@
1
- namespace Blueprint.Core.Dtos.Others
2
- {
3
- public class BaseDto
4
- {
5
- /// <summary>
6
- /// Id
7
- /// </summary>
8
- public int? Id { get; set; }
9
- }
10
- }