Checkpoint: v2.0完整版本:新增社区排行榜、每日打卡、24种成就徽章、实时摄像头姿势分析、在线录制(稳定压缩流/断线重连/自动剪辑)、移动端全面适配。47个测试通过。包含完整开发文档。

这个提交包含在:
Manus
2026-03-14 08:04:00 -04:00
父节点 36907d1110
当前提交 2c418b482e
修改 22 个文件,包含 4370 行新增41 行删除

查看文件

@@ -0,0 +1,22 @@
CREATE TABLE `daily_checkins` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`checkinDate` varchar(10) NOT NULL,
`streakCount` int NOT NULL DEFAULT 1,
`notes` text,
`minutesTrained` int DEFAULT 0,
`createdAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `daily_checkins_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `user_badges` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`badgeKey` varchar(64) NOT NULL,
`earnedAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `user_badges_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
ALTER TABLE `users` ADD `currentStreak` int DEFAULT 0;--> statement-breakpoint
ALTER TABLE `users` ADD `longestStreak` int DEFAULT 0;--> statement-breakpoint
ALTER TABLE `users` ADD `totalShots` int DEFAULT 0;

查看文件

@@ -0,0 +1,855 @@
{
"version": "5",
"dialect": "mysql",
"id": "0892fd57-f758-43a7-a72d-e372aca4d4e3",
"prevId": "a9a3ce4f-a15b-4af1-b99f-d12a1644a83b",
"tables": {
"daily_checkins": {
"name": "daily_checkins",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"checkinDate": {
"name": "checkinDate",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"streakCount": {
"name": "streakCount",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"minutesTrained": {
"name": "minutesTrained",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"daily_checkins_id": {
"name": "daily_checkins_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"pose_analyses": {
"name": "pose_analyses",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"videoId": {
"name": "videoId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"overallScore": {
"name": "overallScore",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"poseMetrics": {
"name": "poseMetrics",
"type": "json",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"detectedIssues": {
"name": "detectedIssues",
"type": "json",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"corrections": {
"name": "corrections",
"type": "json",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"exerciseType": {
"name": "exerciseType",
"type": "varchar(64)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"framesAnalyzed": {
"name": "framesAnalyzed",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"shotCount": {
"name": "shotCount",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"avgSwingSpeed": {
"name": "avgSwingSpeed",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"maxSwingSpeed": {
"name": "maxSwingSpeed",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"totalMovementDistance": {
"name": "totalMovementDistance",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"strokeConsistency": {
"name": "strokeConsistency",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"footworkScore": {
"name": "footworkScore",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"fluidityScore": {
"name": "fluidityScore",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"keyMoments": {
"name": "keyMoments",
"type": "json",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"movementTrajectory": {
"name": "movementTrajectory",
"type": "json",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"pose_analyses_id": {
"name": "pose_analyses_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"rating_history": {
"name": "rating_history",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"rating": {
"name": "rating",
"type": "float",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"reason": {
"name": "reason",
"type": "varchar(256)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"dimensionScores": {
"name": "dimensionScores",
"type": "json",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"analysisId": {
"name": "analysisId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"rating_history_id": {
"name": "rating_history_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"training_plans": {
"name": "training_plans",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"title": {
"name": "title",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"skillLevel": {
"name": "skillLevel",
"type": "enum('beginner','intermediate','advanced')",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"durationDays": {
"name": "durationDays",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 7
},
"exercises": {
"name": "exercises",
"type": "json",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"isActive": {
"name": "isActive",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"adjustmentNotes": {
"name": "adjustmentNotes",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"version": {
"name": "version",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"onUpdate": true,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"training_plans_id": {
"name": "training_plans_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"training_records": {
"name": "training_records",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"planId": {
"name": "planId",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"exerciseName": {
"name": "exerciseName",
"type": "varchar(128)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"durationMinutes": {
"name": "durationMinutes",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"completed": {
"name": "completed",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"poseScore": {
"name": "poseScore",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"trainingDate": {
"name": "trainingDate",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"training_records_id": {
"name": "training_records_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"training_videos": {
"name": "training_videos",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"title": {
"name": "title",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"fileKey": {
"name": "fileKey",
"type": "varchar(512)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"format": {
"name": "format",
"type": "varchar(16)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"fileSize": {
"name": "fileSize",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"duration": {
"name": "duration",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"exerciseType": {
"name": "exerciseType",
"type": "varchar(64)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"analysisStatus": {
"name": "analysisStatus",
"type": "enum('pending','analyzing','completed','failed')",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'pending'"
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"onUpdate": true,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"training_videos_id": {
"name": "training_videos_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"user_badges": {
"name": "user_badges",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"badgeKey": {
"name": "badgeKey",
"type": "varchar(64)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"earnedAt": {
"name": "earnedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"user_badges_id": {
"name": "user_badges_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {},
"checkConstraint": {}
},
"username_accounts": {
"name": "username_accounts",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"username": {
"name": "username",
"type": "varchar(64)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"userId": {
"name": "userId",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"username_accounts_id": {
"name": "username_accounts_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {
"username_accounts_username_unique": {
"name": "username_accounts_username_unique",
"columns": [
"username"
]
}
},
"checkConstraint": {}
},
"users": {
"name": "users",
"columns": {
"id": {
"name": "id",
"type": "int",
"primaryKey": false,
"notNull": true,
"autoincrement": true
},
"openId": {
"name": "openId",
"type": "varchar(64)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"email": {
"name": "email",
"type": "varchar(320)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"loginMethod": {
"name": "loginMethod",
"type": "varchar(64)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"role": {
"name": "role",
"type": "enum('user','admin')",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'user'"
},
"skillLevel": {
"name": "skillLevel",
"type": "enum('beginner','intermediate','advanced')",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'beginner'"
},
"trainingGoals": {
"name": "trainingGoals",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"ntrpRating": {
"name": "ntrpRating",
"type": "float",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 1.5
},
"totalSessions": {
"name": "totalSessions",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"totalMinutes": {
"name": "totalMinutes",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"currentStreak": {
"name": "currentStreak",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"longestStreak": {
"name": "longestStreak",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"totalShots": {
"name": "totalShots",
"type": "int",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": 0
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"onUpdate": true,
"default": "(now())"
},
"lastSignedIn": {
"name": "lastSignedIn",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(now())"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {
"users_id": {
"name": "users_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {
"users_openId_unique": {
"name": "users_openId_unique",
"columns": [
"openId"
]
}
},
"checkConstraint": {}
}
},
"views": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"tables": {},
"indexes": {}
}
}

查看文件

@@ -22,6 +22,13 @@
"when": 1773487643444,
"tag": "0002_overrated_shriek",
"breakpoints": true
},
{
"idx": 3,
"version": "5",
"when": 1773488765349,
"tag": "0003_married_iron_lad",
"breakpoints": true
}
]
}

查看文件

@@ -20,6 +20,12 @@ export const users = mysqlTable("users", {
totalSessions: int("totalSessions").default(0),
/** Total training minutes */
totalMinutes: int("totalMinutes").default(0),
/** Current consecutive check-in streak */
currentStreak: int("currentStreak").default(0),
/** Longest ever streak */
longestStreak: int("longestStreak").default(0),
/** Total shots across all analyses */
totalShots: int("totalShots").default(0),
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
lastSignedIn: timestamp("lastSignedIn").defaultNow().notNull(),
@@ -181,3 +187,38 @@ export const ratingHistory = mysqlTable("rating_history", {
export type RatingHistory = typeof ratingHistory.$inferSelect;
export type InsertRatingHistory = typeof ratingHistory.$inferInsert;
/**
* Daily check-in records for streak tracking
*/
export const dailyCheckins = mysqlTable("daily_checkins", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
/** Check-in date (YYYY-MM-DD stored as string for easy comparison) */
checkinDate: varchar("checkinDate", { length: 10 }).notNull(),
/** Current streak at the time of check-in */
streakCount: int("streakCount").notNull().default(1),
/** Optional notes for the day */
notes: text("notes"),
/** Training minutes logged this day */
minutesTrained: int("minutesTrained").default(0),
createdAt: timestamp("createdAt").defaultNow().notNull(),
});
export type DailyCheckin = typeof dailyCheckins.$inferSelect;
export type InsertDailyCheckin = typeof dailyCheckins.$inferInsert;
/**
* Achievement badges earned by users
*/
export const userBadges = mysqlTable("user_badges", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
/** Badge identifier key */
badgeKey: varchar("badgeKey", { length: 64 }).notNull(),
/** When the badge was earned */
earnedAt: timestamp("earnedAt").defaultNow().notNull(),
});
export type UserBadge = typeof userBadges.$inferSelect;
export type InsertUserBadge = typeof userBadges.$inferInsert;