Skip to content

Commit

Permalink
Rename GroupType to SupportedGroupType (#6519)
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph committed Jul 25, 2024
1 parent 65cc856 commit 360ece4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions front/lib/resources/storage/models/groups.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GroupType } from "@dust-tt/types";
import type { SupportedGroupType } from "@dust-tt/types";
import { isGlobalGroupType, isSystemGroupType } from "@dust-tt/types";
import type {
CreationOptional,
Expand All @@ -21,7 +21,7 @@ export class GroupModel extends Model<
declare updatedAt: CreationOptional<Date>;

declare name: string;
declare type: GroupType;
declare type: SupportedGroupType;

declare workspaceId: ForeignKey<Workspace["id"]>;
}
Expand Down
14 changes: 8 additions & 6 deletions types/src/front/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@
* Contains specific users added by workspace admins.
* Has access to the list of Vaults configured by workspace admins.
*/
export const GROUP_TYPES = ["regular", "global", "system"] as const;
export type GroupType = (typeof GROUP_TYPES)[number];
export const SUPPORTED_GROUP_TYPES = ["regular", "global", "system"] as const;
export type SupportedGroupType = (typeof SUPPORTED_GROUP_TYPES)[number];

export function isValidGroupType(value: unknown): value is GroupType {
return GROUP_TYPES.includes(value as GroupType);
export function isSupportedGroupType(
value: unknown
): value is SupportedGroupType {
return SUPPORTED_GROUP_TYPES.includes(value as SupportedGroupType);
}
export function isSystemGroupType(value: GroupType): boolean {
export function isSystemGroupType(value: SupportedGroupType): boolean {
return value === "system";
}
export function isGlobalGroupType(value: GroupType): boolean {
export function isGlobalGroupType(value: SupportedGroupType): boolean {
return value === "global";
}

0 comments on commit 360ece4

Please sign in to comment.