-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from codex-team/feat/teams-base
- Loading branch information
Showing
14 changed files
with
427 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
ALTER TABLE IF EXISTS public.note_settings | ||
RENAME COLUMN enabled TO is_public; | ||
DO $$ | ||
BEGIN | ||
IF EXISTS(SELECT * | ||
FROM information_schema.columns | ||
WHERE table_name='note_settings' and column_name='enabled') | ||
THEN | ||
ALTER TABLE "public"."note_settings" RENAME COLUMN "enables" TO "is_public"; | ||
END IF; | ||
END $$; |
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,44 @@ | ||
import type { NoteInternalId } from './note.js'; | ||
import type User from './user.js'; | ||
|
||
export enum MemberRole { | ||
/** | ||
* Team member can read and write notes | ||
*/ | ||
read = 'read', | ||
|
||
/** | ||
* Team member can only read notes | ||
*/ | ||
write = 'write', | ||
} | ||
|
||
/** | ||
* Class representing a team entity | ||
* Team is a relation between note and user, which shows what user can do with note | ||
*/ | ||
export interface TeamMember { | ||
/** | ||
* Team relation id | ||
*/ | ||
id: number; | ||
|
||
/** | ||
* Note ID | ||
*/ | ||
noteId: NoteInternalId; | ||
|
||
/** | ||
* Team member user id | ||
*/ | ||
userId: User['id']; | ||
|
||
/** | ||
* Team member role, show what user can do with note | ||
*/ | ||
role: MemberRole; | ||
} | ||
|
||
export type Team = TeamMember[]; | ||
|
||
export type TeamMemberCreationAttributes = Omit<TeamMember, '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
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
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
Oops, something went wrong.