Files
Tom Moor 8433475ef6 feat: Show who added a member in the group members table (#14000)
* feat: Show who added a member in the group members table

* fix: Make timestamps with tooltip detail keyboard accessible
2026-10-09 21:29:51 +00:00

48 lines
1.1 KiB
TypeScript

import type { GroupPermission } from "@shared/types";
import Group from "./Group";
import User from "./User";
import Model from "./base/Model";
import Relation from "./decorators/Relation";
import Field from "./decorators/Field";
import { observable } from "mobx";
/**
* Represents a user's membership to a group.
*/
class GroupUser extends Model {
static modelName = "GroupUser";
constructor(fields: Record<string, unknown>, store: Model["store"]) {
super(fields, store);
this.initialize(fields);
}
/** The ID of the user. */
userId: string;
/** The user that belongs to the group. */
@Relation(() => User, { onDelete: "cascade" })
user: User;
/** The ID of the group. */
groupId: string;
/** The group that the user belongs to. */
@Relation(() => Group, { onDelete: "cascade" })
group: Group;
/** The ID of the user that added the user to the group. */
createdById: string;
/** The user that added the user to the group. */
@Relation(() => User, { onDelete: "null" })
createdBy?: User;
/** The permission of the user in the group. */
@Field
@observable
permission: GroupPermission;
}
export default GroupUser;