feat: add survey view with voting functionality and admin panel

- Implemented SurveyView.vue for displaying and managing polls, including voting, comments, and results.
- Added new database tables for vote polls, votes, and comments in migration script.
- Created unique lottery logic for handling unique item rewards based on voting.
- Developed unit tests for unique lottery functionality to ensure deterministic behavior and correct counting of occupied unique items.
This commit is contained in:
2026-02-03 18:25:26 +00:00
parent d3277f204a
commit b0a8f768e9
15 changed files with 2531 additions and 22 deletions
+49 -22
View File
@@ -115,14 +115,25 @@ export type TurnDaemonCommand =
top16: number[];
top8: number[];
top4: number[];
}
| {
type: 'setNationMeta';
requestId?: string;
nationId: number;
updates: Record<string, unknown>;
expectedUpdatedAt?: string;
}
}
| {
type: 'voteReward';
requestId?: string;
voteId: number;
generalId: number;
goldReward: number;
unique?: {
expected: boolean;
itemKey?: string | null;
};
}
| {
type: 'setNationMeta';
requestId?: string;
nationId: number;
updates: Record<string, unknown>;
expectedUpdatedAt?: string;
}
| {
type: 'adjustGeneralResources';
requestId?: string;
@@ -264,20 +275,36 @@ export type TurnDaemonCommandResult =
winnerId: number;
runnerUpId: number;
reason: string;
}
| {
type: 'setNationMeta';
ok: true;
nationId: number;
updatedAt: string;
}
| {
type: 'setNationMeta';
ok: false;
nationId: number;
reason: string;
currentUpdatedAt?: string;
}
}
| {
type: 'voteReward';
ok: true;
voteId: number;
generalId: number;
awardedUnique: boolean;
itemKey?: string | null;
alreadyApplied?: boolean;
}
| {
type: 'voteReward';
ok: false;
voteId: number;
generalId: number;
reason: string;
}
| {
type: 'setNationMeta';
ok: true;
nationId: number;
updatedAt: string;
}
| {
type: 'setNationMeta';
ok: false;
nationId: number;
reason: string;
currentUpdatedAt?: string;
}
| {
type: 'adjustGeneralResources';
ok: true;