Skip to content

Commit e3bbef9

Browse files
committed
feat(widget): add mandatory type field to Widget model
- Added new non-nullable column 'type' to Widget table in Prisma schema - Updated Prisma migration SQL to include 'type' column without default value - Enhanced generated Prisma client types and inputs with 'type' field - Enabled debugging routes in app router configuration - Integrated @ngx-formly/core and @ngx-formly/bootstrap modules for form handling with Bootstrap styles - Marked service injections as readonly and private for better encapsulation - Completed partial tasks for tRPC routes and Dashboard-Widgets-Device linkage in project tasks document - Added new dependencies @ngx-formly/core and @ngx-formly/bootstrap with compatible Bootstrap and Popper peer dependencies
1 parent d1f7327 commit e3bbef9

36 files changed

+909
-250
lines changed

PROJECT_TASKS_RU.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
**Статус**: ⚠️ ЧАСТИЧНО ЗАВЕРШЕНО
4747

4848
**Задачи**:
49-
- [ ] tRPC маршруты для Dashboards: create/read/update/delete (0.5ч)
50-
- [ ] tRPC маршруты для Widgets: create/read/update/delete (0.5ч)
49+
- [x] tRPC маршруты для Dashboards: create/read/update/delete (0.5ч)
50+
- [x] tRPC маршруты для Widgets: create/read/update/delete (0.5ч)
5151
- [x] Генерация QR-кода для привязки телефона (`qrcode.react` или Svelte/AnalogJS аналог) (0.5ч)
52-
- [ ] Связь Dashboard → Widgets → Device через deviceId (0.25ч)
52+
- [x] Связь Dashboard → Widgets → Device через deviceId (0.25ч)
5353
- [x] Настройка индексов и уникальных ограничений через Prisma (0.25ч)
5454

5555
**Ретроспектива**:

web/package-lock.json

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
"@angular/platform-browser": "^20.0.0",
4444
"@angular/platform-server": "^20.0.0",
4545
"@angular/router": "^20.0.0",
46+
"@ngx-formly/bootstrap": "^7.0.1",
47+
"@ngx-formly/core": "^7.0.1",
4648
"@picocss/pico": "^2.1.1",
4749
"@prisma/adapter-pg": "^6.18.0",
4850
"@prisma/client": "^6.19.0",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `type` to the `Widget` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "Widget" ADD COLUMN "type" TEXT NOT NULL;

web/prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ model QrCode {
8080

8181
model Widget {
8282
id String @id(map: "PK_WIDGET") @default(uuid()) @db.Uuid
83+
type String
8384
options Json?
8485
state Json?
8586
columnIndex Int?

web/src/app/app.config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
1+
import {
2+
provideFileRouter,
3+
requestContextInterceptor,
4+
withDebugRoutes,
5+
} from '@analogjs/router';
26
import {
37
provideHttpClient,
48
withFetch,
@@ -18,6 +22,8 @@ import {
1822
withEventReplay,
1923
} from '@angular/platform-browser';
2024
import { withComponentInputBinding } from '@angular/router';
25+
import { withFormlyBootstrap } from '@ngx-formly/bootstrap';
26+
import { provideFormlyCore } from '@ngx-formly/core';
2127
import { firstValueFrom } from 'rxjs';
2228

2329
import { AuthService } from './services/auth.service';
@@ -28,9 +34,10 @@ import { provideTrpcClient } from './trpc-client';
2834

2935
export const appConfig: ApplicationConfig = {
3036
providers: [
37+
provideFormlyCore(...withFormlyBootstrap()),
3138
provideBrowserGlobalErrorListeners(),
3239
provideZoneChangeDetection({ eventCoalescing: true }),
33-
provideFileRouter(withComponentInputBinding()),
40+
provideFileRouter(withComponentInputBinding(), withDebugRoutes()),
3441
provideHttpClient(
3542
withFetch(),
3643
withInterceptors([requestContextInterceptor])

web/src/app/app.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ import { AuthService } from './services/auth.service';
5858
</footer>`,
5959
})
6060
export class AppComponent {
61-
private authService = inject(AuthService);
62-
63-
private router = inject(Router);
61+
private readonly authService = inject(AuthService);
62+
private readonly router = inject(Router);
6463

6564
signOut() {
6665
this.authService

web/src/app/components/theme/color-scheme-switcher.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ import { ThemeService } from '../../services/theme.service';
9999
`,
100100
})
101101
export class ColorSchemeSwitcherComponent {
102-
readonly themeService = inject(ThemeService);
102+
private readonly themeService = inject(ThemeService);
103103

104104
theme$ = this.themeService.stream$;
105105
themeLabel$ = this.themeService.stream$.pipe(

web/src/app/generated/prisma/internal/class.ts

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

web/src/app/generated/prisma/internal/prismaNamespace.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ export type QrCodeScalarFieldEnum = (typeof QrCodeScalarFieldEnum)[keyof typeof
949949

950950
export const WidgetScalarFieldEnum = {
951951
id: 'id',
952+
type: 'type',
952953
options: 'options',
953954
state: 'state',
954955
columnIndex: 'columnIndex',

0 commit comments

Comments
 (0)