Skip to content

Commit

Permalink
Add common types for search operator and the logged in user
Browse files Browse the repository at this point in the history
  • Loading branch information
floscher committed Jun 21, 2024
1 parent 830c3ee commit 173c8c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export * from "./entity/User.js";
export * from "./entity/UserRole.js";
export * from "./entity/permission/UserRolePermissions.js";
export * from "./markdown-converter-common.js";
export * from "./types/logged-in-user-info.js";
export * from "./types/search-operator.js";
export * from "./util/base64.js";
export * from "./util/cookie-header-helpers.js";
export * from "./util/filesize.js";
Expand Down
7 changes: 7 additions & 0 deletions common/src/types/logged-in-user-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { UserRolePermissionsType } from "@common/entity/permission/UserRolePermissions.js";
import type { User } from "@common/entity/User.js";

export type LoggedInUserInfo = {
user: User;
permissions: UserRolePermissionsType;
};
5 changes: 5 additions & 0 deletions common/src/types/search-operator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type SearchOperator = "and" | "or";

export function asSearchOperator(s: string | undefined | null): SearchOperator {
return s?.toLowerCase() === "or" ? "or" : "and";
}

0 comments on commit 173c8c1

Please sign in to comment.