-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: maintain brain last_update time
- Loading branch information
1 parent
b67e2db
commit 8e477cc
Showing
7 changed files
with
87 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from uuid import UUID | ||
|
||
from models.settings import get_supabase_db | ||
|
||
|
||
def update_brain_last_update_time(brain_id: UUID): | ||
supabase_db = get_supabase_db() | ||
supabase_db.update_brain_last_update_time(brain_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...nd/app/brains-management/[brainId]/components/BrainManagementTabs/utils/canManageBrain.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { UUID } from "crypto"; | ||
|
||
import { MinimalBrainForUser } from "@/lib/context/BrainProvider/types"; | ||
|
||
type IsUserBrainOwnerProps = { | ||
userAccessibleBrains: MinimalBrainForUser[]; | ||
brainId?: UUID; | ||
}; | ||
export const isUserBrainOwner = ({ | ||
brainId, | ||
userAccessibleBrains, | ||
}: IsUserBrainOwnerProps): boolean => { | ||
const brain = userAccessibleBrains.find(({ id }) => id === brainId); | ||
if (brain === undefined) { | ||
return false; | ||
} | ||
|
||
return brain.role === "Owner"; | ||
}; |