Web: GroupList's Person was adapters/repo's Member field for field, and AccountList's Account was the session store's User; both now import them. The bridge's Identity stays, as the Tauri mirror of the core's struct. Server: auth._serialize_user and accounts' _serialize_account wrote the same four fields. serialize.serialize_user is serialize_person plus is_admin, and the account list adds created_at to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { api } from "../api/client";
|
||||
import type { Member } from "../adapters/repo";
|
||||
import { errorMessage } from "../api/errors";
|
||||
import BaseButton from "./BaseButton.vue";
|
||||
import BaseInput from "./BaseInput.vue";
|
||||
@@ -11,24 +12,18 @@ import { useRowAction, useLoad } from "../composables/useAction";
|
||||
// the instance's; anyone can share with it, and a note shared with it reaches whoever
|
||||
// is in it at the time, so adding or removing someone here changes what they see.
|
||||
|
||||
interface Person {
|
||||
id: string;
|
||||
display_name: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
interface Group {
|
||||
id: string;
|
||||
name: string;
|
||||
members: Person[];
|
||||
members: Member[];
|
||||
}
|
||||
|
||||
const groups = ref<Group[]>([]);
|
||||
const accounts = ref<Person[]>([]);
|
||||
const accounts = ref<Member[]>([]);
|
||||
const { loading, error, load } = useLoad(async () => {
|
||||
const [g, a] = await Promise.all([
|
||||
api.get<{ groups: Group[] }>("/api/groups"),
|
||||
api.get<{ accounts: Person[] }>("/api/accounts"),
|
||||
api.get<{ accounts: Member[] }>("/api/accounts"),
|
||||
]);
|
||||
groups.value = g.groups;
|
||||
accounts.value = a.accounts;
|
||||
@@ -41,7 +36,7 @@ const picks = ref<Record<string, string>>({});
|
||||
|
||||
const byName = (a: Group, b: Group) => a.name.localeCompare(b.name);
|
||||
|
||||
function outside(group: Group): Person[] {
|
||||
function outside(group: Group): Member[] {
|
||||
const inside = new Set(group.members.map((m) => m.id));
|
||||
return accounts.value.filter((a) => !inside.has(a.id));
|
||||
}
|
||||
@@ -102,7 +97,7 @@ function addMember(group: Group) {
|
||||
);
|
||||
}
|
||||
|
||||
function removeMember(group: Group, person: Person) {
|
||||
function removeMember(group: Group, person: Member) {
|
||||
void act(
|
||||
group.id,
|
||||
async () => replace(await api.del<Group>(`/api/groups/${group.id}/members/${person.id}`)),
|
||||
|
||||
Reference in New Issue
Block a user