Add server renaming functionality (#533)

This commit is contained in:
samanhappy
2025-12-30 18:45:33 +08:00
committed by GitHub
parent 88ce94b988
commit 8ae542bdab
11 changed files with 238 additions and 12 deletions

View File

@@ -115,6 +115,15 @@ export class ServerDaoDbImpl implements ServerDao {
return result !== null;
}
async rename(oldName: string, newName: string): Promise<boolean> {
// Check if newName already exists
if (await this.repository.exists(newName)) {
throw new Error(`Server ${newName} already exists`);
}
return await this.repository.rename(oldName, newName);
}
private mapToServerConfig(server: {
name: string;
type?: string;