2021-01-27 08:45:18 +03:00
|
|
|
import { Path, Patp } from "..";
|
2021-02-17 05:35:28 +03:00
|
|
|
import {Resource} from "../groups/update.d";
|
2021-01-27 08:45:18 +03:00
|
|
|
|
|
|
|
export type ContactUpdate =
|
|
|
|
| ContactUpdateAdd
|
|
|
|
| ContactUpdateRemove
|
|
|
|
| ContactUpdateEdit
|
|
|
|
| ContactUpdateInitial
|
|
|
|
|
|
|
|
interface ContactUpdateAdd {
|
|
|
|
add: {
|
|
|
|
ship: Patp;
|
|
|
|
contact: Contact;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ContactUpdateRemove {
|
|
|
|
remove: {
|
|
|
|
ship: Patp;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ContactUpdateEdit {
|
|
|
|
edit: {
|
|
|
|
path: Path;
|
|
|
|
ship: Patp;
|
2021-02-17 05:23:49 +03:00
|
|
|
"edit-field": ContactEditField;
|
|
|
|
timestamp: number;
|
2021-01-27 08:45:18 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
interface ContactUpdateAllowShips {
|
|
|
|
allow: {
|
|
|
|
ships: Patp[];
|
|
|
|
}
|
2021-01-27 08:45:18 +03:00
|
|
|
}
|
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
interface ContactUpdateAllowGroup {
|
|
|
|
allow: {
|
|
|
|
group: Path;
|
|
|
|
}
|
2021-01-27 08:45:18 +03:00
|
|
|
}
|
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
interface ContactUpdateSetPublic {
|
|
|
|
'set-public': boolean;
|
|
|
|
}
|
2021-01-27 08:45:18 +03:00
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
export interface ContactShare {
|
|
|
|
share: Patp;
|
|
|
|
}
|
2021-01-27 08:45:18 +03:00
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
interface ContactUpdateInitial {
|
|
|
|
initial: Rolodex;
|
|
|
|
}
|
2021-01-27 08:45:18 +03:00
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
export type Rolodex = {
|
2021-01-27 08:45:18 +03:00
|
|
|
[p in Patp]: Contact;
|
|
|
|
};
|
|
|
|
|
|
|
|
export interface Contact {
|
|
|
|
nickname: string;
|
2021-02-17 05:23:49 +03:00
|
|
|
bio: string;
|
|
|
|
status: string;
|
2021-01-27 08:45:18 +03:00
|
|
|
color: string;
|
|
|
|
avatar: string | null;
|
2021-02-17 05:23:49 +03:00
|
|
|
cover: string | null;
|
|
|
|
groups: Path[];
|
|
|
|
'last-updated': number;
|
2021-01-27 08:45:18 +03:00
|
|
|
}
|
|
|
|
|
2021-02-17 05:23:49 +03:00
|
|
|
type ContactKeys = keyof Contact;
|
|
|
|
|
|
|
|
export type ContactEditFieldPrim = Exclude<ContactKeys, "groups" | "last-updated">;
|
|
|
|
|
|
|
|
export type ContactEditField = Partial<Pick<Contact, ContactEditFieldPrim>> & {
|
|
|
|
'add-group'?: Resource;
|
|
|
|
'remove-group'?: Resource;
|
2021-01-27 08:45:18 +03:00
|
|
|
};
|