diff --git a/.gitignore b/.gitignore index cc006b58..c914036d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ yarn-error.log* # Misc .DS_Store *.pem + + +evault-cache.json \ No newline at end of file diff --git a/infrastructure/control-panel/package.json b/infrastructure/control-panel/package.json index 78ced26d..6f2f7a16 100644 --- a/infrastructure/control-panel/package.json +++ b/infrastructure/control-panel/package.json @@ -50,6 +50,7 @@ "flowbite": "^3.1.2", "flowbite-svelte": "^1.10.7", "flowbite-svelte-icons": "^2.2.1", + "lowdb": "^9.1.0", "lucide-svelte": "^0.539.0", "tailwind-merge": "^3.0.2" } diff --git a/infrastructure/control-panel/src/lib/components/EVaultList.svelte b/infrastructure/control-panel/src/lib/components/EVaultList.svelte new file mode 100644 index 00000000..46dee510 --- /dev/null +++ b/infrastructure/control-panel/src/lib/components/EVaultList.svelte @@ -0,0 +1,143 @@ + + +
+ Only chartered groups can create polls. Groups without a charter will be disabled. +
{errors.groupId && (
{errors.groupId.message}
diff --git a/platforms/eVoting/src/lib/pollApi.ts b/platforms/eVoting/src/lib/pollApi.ts
index 6e7cfebd..5b936160 100644
--- a/platforms/eVoting/src/lib/pollApi.ts
+++ b/platforms/eVoting/src/lib/pollApi.ts
@@ -53,6 +53,7 @@ export interface Group {
owner: string;
isPrivate: boolean;
visibility: "public" | "private" | "restricted";
+ charter?: string; // Markdown content for the group charter
createdAt: string;
updatedAt: string;
}
diff --git a/platforms/evoting-api/src/controllers/PollController.ts b/platforms/evoting-api/src/controllers/PollController.ts
index ec9bf0f5..4c199ac3 100644
--- a/platforms/evoting-api/src/controllers/PollController.ts
+++ b/platforms/evoting-api/src/controllers/PollController.ts
@@ -74,6 +74,14 @@ export class PollController {
res.status(201).json(poll);
} catch (error) {
console.error("Error creating poll:", error);
+
+ // Handle specific charter validation error
+ if (error instanceof Error && error.message === "Only chartered groups can create polls") {
+ return res.status(400).json({
+ error: "Only chartered groups can create polls. Please select a group with a charter."
+ });
+ }
+
res.status(500).json({ error: "Failed to create poll" });
}
};
diff --git a/platforms/evoting-api/src/controllers/WebhookController.ts b/platforms/evoting-api/src/controllers/WebhookController.ts
index df93a522..fa151565 100644
--- a/platforms/evoting-api/src/controllers/WebhookController.ts
+++ b/platforms/evoting-api/src/controllers/WebhookController.ts
@@ -150,6 +150,8 @@ export class WebhookController {
group.owner = local.data.owner as string;
group.admins = adminIds.map(id => ({ id } as User));
group.participants = participants;
+ group.charter = local.data.charter as string;
+ group.ename = local.data.ename as string
this.adapter.addToLockedIds(localId);
await this.groupService.groupRepository.save(group);
@@ -162,9 +164,8 @@ export class WebhookController {
local.data.owner as string,
adminIds,
participants.map(p => p.id),
- local.data.charter as string | undefined
+ local.data.charter as string | undefined,
);
-
console.log("Created group with ID:", group.id);
console.log(group)
this.adapter.addToLockedIds(group.id);
diff --git a/platforms/evoting-api/src/database/entities/Group.ts b/platforms/evoting-api/src/database/entities/Group.ts
index 5c3f7788..6892aa56 100644
--- a/platforms/evoting-api/src/database/entities/Group.ts
+++ b/platforms/evoting-api/src/database/entities/Group.ts
@@ -58,6 +58,9 @@ export class Group {
})
participants!: User[];
+ @Column({ nullable: true})
+ ename: string
+
@Column({ nullable: true })
avatarUrl!: string;
diff --git a/platforms/evoting-api/src/database/migrations/1756065047421-migration.ts b/platforms/evoting-api/src/database/migrations/1756065047421-migration.ts
new file mode 100644
index 00000000..f4864168
--- /dev/null
+++ b/platforms/evoting-api/src/database/migrations/1756065047421-migration.ts
@@ -0,0 +1,14 @@
+import { MigrationInterface, QueryRunner } from "typeorm";
+
+export class Migration1756065047421 implements MigrationInterface {
+ name = 'Migration1756065047421'
+
+ public async up(queryRunner: QueryRunner): Promise
+ {group.ename}
+
{group.name || 'Unnamed Group'}
+ {group.ename && (
+
{group.name || 'Unnamed Group'}
+ {group.ename && (
+