Files
workavia-drive/tdrive/backend/node/src/services/channels/entities/default-channel.ts
T
Montassar Ghanmy e0615fa867 📁 Changed TDrive root folder (#16)
📁 Changed TDrive root folder
2023-04-11 10:04:29 +01:00

35 lines
986 B
TypeScript

import { Type } from "class-transformer";
import { merge } from "lodash";
import { Column, Entity } from "../../../core/platform/services/database/services/orm/decorators";
import { ChannelType } from "../types";
@Entity("default_channels", {
primaryKey: [["company_id", "workspace_id"], "channel_id"],
type: "default_channels",
})
export class DefaultChannel {
// uuid-v4
@Type(() => String)
@Column("company_id", "string", { generator: "uuid" })
company_id: string;
// "uuid-v4" | "direct"
@Type(() => String)
@Column("workspace_id", "string", { generator: "uuid" })
workspace_id: string | ChannelType.DIRECT;
// uuid-v4
@Type(() => String)
@Column("channel_id", "string", { generator: "uuid" })
channel_id: string;
}
export type DefaultChannelPrimaryKey = Pick<
DefaultChannel,
"channel_id" | "company_id" | "workspace_id"
>;
export function getInstance(channel: DefaultChannel): DefaultChannel {
return merge(new DefaultChannel(), channel);
}