feat: možnost označení návrhu jako vyřešeného (resolved)
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 21s
CI / Build server (push) Successful in 24s
CI / Build client (push) Successful in 36s
CI / Playwright E2E tests (push) Successful in 1m18s
CI / Build and push Docker image (push) Successful in 41s
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 21s
CI / Build server (push) Successful in 24s
CI / Build client (push) Successful in 36s
CI / Playwright E2E tests (push) Successful in 1m18s
CI / Build and push Docker image (push) Successful in 41s
CI / Notify (push) Successful in 2s
This commit is contained in:
@@ -13,6 +13,8 @@ interface StoredSuggestion {
|
||||
upvoters: string[];
|
||||
/** Loginy uživatelů hlasujících PROTI návrhu */
|
||||
downvoters: string[];
|
||||
/** Příznak vyřešeného (zapracovaného) návrhu - nastavuje se pouze ručním zásahem do dat */
|
||||
resolved?: boolean;
|
||||
}
|
||||
|
||||
const storage = getStorage();
|
||||
@@ -42,6 +44,7 @@ function toDto(suggestion: StoredSuggestion, login: string): Suggestion {
|
||||
voteScore: suggestion.upvoters.length - suggestion.downvoters.length,
|
||||
myVote,
|
||||
isMine: suggestion.author === login,
|
||||
resolved: suggestion.resolved ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -105,6 +108,9 @@ export async function voteSuggestion(login: string, id: string, direction: VoteD
|
||||
if (!suggestion) {
|
||||
throw new Error('Návrh nebyl nalezen');
|
||||
}
|
||||
if (suggestion.resolved) {
|
||||
throw new Error('Pro vyřešený návrh nelze hlasovat');
|
||||
}
|
||||
const hadUp = suggestion.upvoters.includes(login);
|
||||
const hadDown = suggestion.downvoters.includes(login);
|
||||
// Nejprve odebereme případný stávající hlas uživatele
|
||||
|
||||
Reference in New Issue
Block a user