Kaynağa Gözat

chore: 更新后端依赖和配置

- 在 package.json 中添加和更新了多个依赖,包括 compression 和 @types/jest
- 在 tsconfig.json 中添加了 types 配置以支持 Node.js 类型
- 清理了多个文件,增加了空行以提高可读性
- 更新了前端 dashboard 组件的样式和结构,优化了用户界面
17846405080 1 ay önce
ebeveyn
işleme
183cc79c34
25 değiştirilmiş dosya ile 105 ekleme ve 29 silme
  1. 16 18
      campus_health_app/backend/package.json
  2. 4 0
      campus_health_app/backend/src/controllers/WeightController.ts
  3. 4 0
      campus_health_app/backend/src/dto/tag.dto.ts
  4. 4 0
      campus_health_app/backend/src/dto/weight-goal.dto.ts
  5. 4 0
      campus_health_app/backend/src/dto/weight-record.dto.ts
  6. 4 0
      campus_health_app/backend/src/entities/AnomalyLog.ts
  7. 3 0
      campus_health_app/backend/src/entities/Tag.ts
  8. 7 4
      campus_health_app/backend/src/entities/User.ts
  9. 3 0
      campus_health_app/backend/src/entities/WeightGoal.ts
  10. 3 0
      campus_health_app/backend/src/entities/WeightRecord.ts
  11. 4 0
      campus_health_app/backend/src/entities/WeightRecordTag.ts
  12. 4 0
      campus_health_app/backend/src/middlewares/auth.middleware.ts
  13. 4 0
      campus_health_app/backend/src/middlewares/error.middleware.ts
  14. 4 0
      campus_health_app/backend/src/middlewares/logger.middleware.ts
  15. 4 0
      campus_health_app/backend/src/routes/index.ts
  16. 4 0
      campus_health_app/backend/src/routes/weight.routes.ts
  17. 4 0
      campus_health_app/backend/src/server.ts
  18. 4 0
      campus_health_app/backend/src/services/StatsService.ts
  19. 4 0
      campus_health_app/backend/src/services/TagService.ts
  20. 4 0
      campus_health_app/backend/src/services/WeightGoalService.ts
  21. 4 0
      campus_health_app/backend/src/services/WeightRecordService.ts
  22. 1 0
      campus_health_app/backend/tsconfig.json
  23. 5 5
      campus_health_app/frontend/campus-health-app/src/app/modules/dashboard/dashboard.component.html
  24. 2 1
      campus_health_app/frontend/campus-health-app/src/app/modules/dashboard/dashboard.component.ts
  25. 1 1
      campus_health_app/frontend/campus-health-app/src/app/shared/page-header/page-header.component.scss

+ 16 - 18
campus_health_app/backend/package.json

@@ -24,41 +24,39 @@
   "author": "",
   "license": "MIT",
   "dependencies": {
-    "express": "^4.18.2",
-    "typeorm": "^0.3.17",
-    "mysql2": "^3.6.5",
-    "reflect-metadata": "^0.1.13",
-    "class-validator": "^0.14.0",
     "class-transformer": "^0.5.1",
-    "dotenv": "^16.3.1",
+    "class-validator": "^0.14.0",
+    "compression": "^1.7.4",
     "cors": "^2.8.5",
-    "helmet": "^7.1.0",
+    "dotenv": "^16.3.1",
+    "express": "^4.18.2",
     "express-rate-limit": "^7.1.5",
-    "uuid": "^9.0.1",
+    "helmet": "^7.1.0",
+    "mysql2": "^3.6.5",
     "redis": "^4.6.11",
-    "winston": "^3.11.0",
-    "compression": "^1.7.4"
+    "reflect-metadata": "^0.1.13",
+    "typeorm": "^0.3.17",
+    "uuid": "^9.0.1",
+    "winston": "^3.11.0"
   },
   "devDependencies": {
-    "@types/express": "^4.17.21",
-    "@types/node": "^20.10.5",
+    "@types/compression": "^1.7.5",
     "@types/cors": "^2.8.17",
+    "@types/express": "^4.17.21",
+    "@types/jest": "^29.5.11",
+    "@types/node": "^20.19.24",
     "@types/uuid": "^9.0.7",
-    "@types/compression": "^1.7.5",
     "@typescript-eslint/eslint-plugin": "^6.15.0",
     "@typescript-eslint/parser": "^6.15.0",
     "eslint": "^8.56.0",
+    "jest": "^29.7.0",
     "prettier": "^3.1.1",
     "ts-node": "^10.9.2",
     "ts-node-dev": "^2.0.0",
-    "typescript": "^5.3.3",
-    "jest": "^29.7.0",
-    "@types/jest": "^29.5.11"
+    "typescript": "^5.3.3"
   },
   "engines": {
     "node": ">=18.0.0",
     "npm": ">=9.0.0"
   }
 }
-
-

+ 4 - 0
campus_health_app/backend/src/controllers/WeightController.ts

@@ -378,3 +378,7 @@ export class WeightController {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/dto/tag.dto.ts

@@ -29,3 +29,7 @@ export class CreateTagDto {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/dto/weight-goal.dto.ts

@@ -54,3 +54,7 @@ export class UpdateWeightGoalDto {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/dto/weight-record.dto.ts

@@ -125,3 +125,7 @@ export class WeightRecordQueryDto {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/entities/AnomalyLog.ts

@@ -83,3 +83,7 @@ export class AnomalyLog {
 
 
 
+
+
+
+

+ 3 - 0
campus_health_app/backend/src/entities/Tag.ts

@@ -70,3 +70,6 @@ export class Tag {
 
 
 
+
+
+

+ 7 - 4
campus_health_app/backend/src/entities/User.ts

@@ -45,16 +45,16 @@ export class User {
   deletedAt!: Date | null;
 
   // 关联关系
-  @OneToMany(() => WeightRecord, weightRecord => weightRecord.user)
+  @OneToMany(() => WeightRecord, (weightRecord: WeightRecord) => weightRecord.user)
   weightRecords!: WeightRecord[];
 
-  @OneToMany(() => WeightGoal, weightGoal => weightGoal.user)
+  @OneToMany(() => WeightGoal, (weightGoal: WeightGoal) => weightGoal.user)
   weightGoals!: WeightGoal[];
 
-  @OneToMany(() => Tag, tag => tag.user)
+  @OneToMany(() => Tag, (tag: Tag) => tag.user)
   tags!: Tag[];
 
-  @OneToMany(() => AnomalyLog, anomalyLog => anomalyLog.user)
+  @OneToMany(() => AnomalyLog, (anomalyLog: AnomalyLog) => anomalyLog.user)
   anomalyLogs!: AnomalyLog[];
 }
 
@@ -72,3 +72,6 @@ export class User {
 
 
 
+
+
+

+ 3 - 0
campus_health_app/backend/src/entities/WeightGoal.ts

@@ -90,3 +90,6 @@ export class WeightGoal {
 
 
 
+
+
+

+ 3 - 0
campus_health_app/backend/src/entities/WeightRecord.ts

@@ -88,3 +88,6 @@ export class WeightRecord {
 
 
 
+
+
+

+ 4 - 0
campus_health_app/backend/src/entities/WeightRecordTag.ts

@@ -55,3 +55,7 @@ export class WeightRecordTag {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/middlewares/auth.middleware.ts

@@ -44,3 +44,7 @@ declare global {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/middlewares/error.middleware.ts

@@ -50,3 +50,7 @@ export const notFoundMiddleware = (
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/middlewares/logger.middleware.ts

@@ -37,3 +37,7 @@ export const loggerMiddleware = (
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/routes/index.ts

@@ -31,3 +31,7 @@ export default router;
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/routes/weight.routes.ts

@@ -70,3 +70,7 @@ export default router;
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/server.ts

@@ -130,3 +130,7 @@ export default app;
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/services/StatsService.ts

@@ -112,3 +112,7 @@ export class StatsService {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/services/TagService.ts

@@ -86,3 +86,7 @@ export class TagService {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/services/WeightGoalService.ts

@@ -139,3 +139,7 @@ export class WeightGoalService {
 
 
 
+
+
+
+

+ 4 - 0
campus_health_app/backend/src/services/WeightRecordService.ts

@@ -245,3 +245,7 @@ export class WeightRecordService {
 
 
 
+
+
+
+

+ 1 - 0
campus_health_app/backend/tsconfig.json

@@ -3,6 +3,7 @@
     "target": "ES2020",
     "module": "commonjs",
     "lib": ["ES2020"],
+    "types": ["node"],
     "outDir": "./dist",
     "rootDir": "./src",
     "strict": true,

+ 5 - 5
campus_health_app/frontend/campus-health-app/src/app/modules/dashboard/dashboard.component.html

@@ -2,11 +2,11 @@
   <!-- 顶部导航栏 -->
   <app-page-header [title]="'数智健调系统'" [subtitle]="'健康管理平台'">
     <div header-actions>
-      <div class="user-info">
-        <span class="welcome-text">欢迎回来!</span>
-        <div class="user-avatar">👤</div>
-      </div>
-      <button class="nav-button" (click)="navigateTo('user-center')">个人中心</button>
+      <!-- <div class="user-info"> -->
+        <!-- <span class="welcome-text">欢迎回来!</span> -->
+        <!-- <div class="user-avatar"></div> -->
+      <!-- </div> -->
+      <button class="nav-button" (click)="navigateTo('user-center')">👤个人中心</button>
       <button class="logout-button" (click)="logout()">退出登录</button>
     </div>
   </app-page-header>

+ 2 - 1
campus_health_app/frontend/campus-health-app/src/app/modules/dashboard/dashboard.component.ts

@@ -4,6 +4,7 @@ import { Router, RouterModule } from '@angular/router';
 import { BaseChartDirective } from 'ng2-charts';
 import { ChartConfiguration, ChartType, ChartData, Chart } from 'chart.js';
 import 'chart.js/auto';
+import { PageHeaderComponent } from '../../shared/page-header/page-header.component';
 
 // 睡眠数据模型
 interface SleepStage {
@@ -40,7 +41,7 @@ interface WeeklySleepData {
 @Component({
   selector: 'app-dashboard',
   standalone: true,
-  imports: [CommonModule, RouterModule, BaseChartDirective],
+  imports: [CommonModule, RouterModule, BaseChartDirective, PageHeaderComponent],
   templateUrl: './dashboard.component.html',
   styleUrl: './dashboard.component.scss'
 })

+ 1 - 1
campus_health_app/frontend/campus-health-app/src/app/shared/page-header/page-header.component.scss

@@ -53,7 +53,7 @@
 
   .header-actions {
     display: flex;
-    gap: 12px;
+    gap: 16px;
     align-items: center;
   }
 }