generated from bywhitebird/starter-node
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #77 from bywhitebird/73-manage-project-creation
73 manage project creation
- Loading branch information
Showing
54 changed files
with
1,405 additions
and
141 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 |
---|---|---|
|
@@ -26,3 +26,6 @@ logs | |
# Panda | ||
styled-system | ||
styled-system-static | ||
|
||
# EdgeDB | ||
dbschema/edgeql-js |
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,84 @@ | ||
module default { | ||
type UserGitHubConnection { | ||
required githubUsername: str { | ||
constraint exclusive; | ||
} | ||
required githubId: int32 { | ||
constraint exclusive; | ||
} | ||
|
||
single link user := .<githubConnection[is User]; | ||
} | ||
|
||
type User { | ||
required name: str; | ||
|
||
single githubConnection: UserGitHubConnection { | ||
readonly := true; | ||
constraint exclusive; | ||
} | ||
|
||
multi link organizations := .<user[is OrganizationMember]; | ||
} | ||
|
||
type OrganizationMember { | ||
required isAdministrator: bool { | ||
default := false; | ||
} | ||
|
||
required single user: User; | ||
required single organization: Organization; | ||
|
||
constraint exclusive on ((.organization, .user)); | ||
} | ||
|
||
type Organization { | ||
required name: str; | ||
|
||
multi projects: Project { | ||
constraint exclusive; | ||
} | ||
|
||
multi link members := .<organization[is OrganizationMember]; | ||
} | ||
|
||
type Project { | ||
required name: str; | ||
|
||
# multi parsers: Parser; | ||
# multi transformers: Transformer; | ||
multi sources: ProjectSource { | ||
constraint exclusive; | ||
}; | ||
|
||
single link organization := .<projects[is Organization]; | ||
} | ||
|
||
# scalar type ParserName extending enum<kaz>; | ||
# type Parser { | ||
# required parserName: ParserName; | ||
# parserParameters: json; | ||
# } | ||
|
||
# scalar type TransformerName extending enum<react, vue>; | ||
# type Transformer { | ||
# required transformerName: TransformerName; | ||
# transformerParameters: json; | ||
# } | ||
|
||
type ProjectSource { | ||
single githubRepository: GitHubRepository { | ||
constraint exclusive; | ||
} | ||
|
||
single link project := .<sources[is Project]; | ||
} | ||
|
||
type GitHubRepository { | ||
required url: str { | ||
constraint regexp(r'^https:\/\/github\.com.*$'); | ||
}; | ||
|
||
single link projectSource := .<githubRepository[is ProjectSource]; | ||
} | ||
} |
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,24 @@ | ||
CREATE MIGRATION m1xrvw7ei4qeqrwdbvtsdab4b7mb7xadnreyfj4b25wngj5zze5ewa | ||
ONTO initial | ||
{ | ||
CREATE TYPE default::User { | ||
CREATE REQUIRED PROPERTY name: std::str; | ||
}; | ||
CREATE TYPE default::UserGitHubConnection { | ||
CREATE REQUIRED PROPERTY githubId: std::int32 { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
CREATE REQUIRED PROPERTY githubUsername: std::str { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::User { | ||
CREATE SINGLE LINK githubConnection: default::UserGitHubConnection { | ||
SET readonly := true; | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::UserGitHubConnection { | ||
CREATE SINGLE LINK user := (.<githubConnection[IS default::User]); | ||
}; | ||
}; |
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,21 @@ | ||
CREATE MIGRATION m1t4s2ey54eij2tqiule2cgysjta4qdtok6mv2g6lfjqhutubdls6q | ||
ONTO m1xrvw7ei4qeqrwdbvtsdab4b7mb7xadnreyfj4b25wngj5zze5ewa | ||
{ | ||
CREATE TYPE default::Organization { | ||
CREATE REQUIRED PROPERTY name: std::str; | ||
}; | ||
CREATE TYPE default::OrganizationMember { | ||
CREATE REQUIRED SINGLE LINK organization: default::Organization; | ||
CREATE REQUIRED SINGLE LINK user: default::User; | ||
CREATE CONSTRAINT std::exclusive ON ((.organization, .user)); | ||
CREATE REQUIRED PROPERTY isAdministrator: std::bool { | ||
SET default := false; | ||
}; | ||
}; | ||
ALTER TYPE default::Organization { | ||
CREATE MULTI LINK members := (.<organization[IS default::OrganizationMember]); | ||
}; | ||
ALTER TYPE default::User { | ||
CREATE MULTI LINK organizations := (.<user[IS default::OrganizationMember]); | ||
}; | ||
}; |
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,15 @@ | ||
CREATE MIGRATION m16aaj63lzt6n4sfmqerswsti74xr6jftgiimfafmen55o35sn5b4q | ||
ONTO m1t4s2ey54eij2tqiule2cgysjta4qdtok6mv2g6lfjqhutubdls6q | ||
{ | ||
CREATE TYPE default::Project { | ||
CREATE REQUIRED PROPERTY name: std::str; | ||
}; | ||
ALTER TYPE default::Organization { | ||
CREATE MULTI LINK projects: default::Project { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::Project { | ||
CREATE SINGLE LINK organization := (.<projects[IS default::Organization]); | ||
}; | ||
}; |
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,25 @@ | ||
CREATE MIGRATION m13upjhjcylvj2xg6tkbukfqbqzmwst2awsnnbreevejh5wkzhv3ja | ||
ONTO m16aaj63lzt6n4sfmqerswsti74xr6jftgiimfafmen55o35sn5b4q | ||
{ | ||
CREATE TYPE default::GitHubRepository { | ||
CREATE REQUIRED PROPERTY url: std::str { | ||
CREATE CONSTRAINT std::regexp(r'^https:\/\/github\.com.*$'); | ||
}; | ||
}; | ||
CREATE TYPE default::ProjectSource { | ||
CREATE SINGLE LINK githubRepository: default::GitHubRepository { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::GitHubRepository { | ||
CREATE SINGLE LINK projectSource := (.<githubRepository[IS default::ProjectSource]); | ||
}; | ||
ALTER TYPE default::Project { | ||
CREATE MULTI LINK sources: default::ProjectSource { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::ProjectSource { | ||
CREATE SINGLE LINK project := (.<sources[IS default::Project]); | ||
}; | ||
}; |
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,2 @@ | ||
[edgedb] | ||
server-version = "4.1" |
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,18 @@ | ||
<template> | ||
<body | ||
:class="css({ | ||
bg: 'appBackground', | ||
color: 'highContrastForeground', | ||
textStyle: 'body', | ||
height: '100dvh', | ||
width: '100dvw', | ||
overflow: 'auto', | ||
scrollbarGutter: 'stable', | ||
})" | ||
> | ||
<NuxtPage /> | ||
</body> | ||
</template> |
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,46 @@ | ||
type AuthService = ( | ||
Extract<Parameters<typeof useFetch>[0], `/api/auth/${string}`> extends `/api/auth/${infer Service}` | ||
? Service | ||
: never | ||
) | ||
|
||
export const useAuth = () => { | ||
const { loggedIn, user, session, clear: clearSession, fetch: fetchSession } = useUserSession() | ||
|
||
async function login(service: AuthService) { | ||
await navigateTo(`/api/auth/${service}`, { | ||
external: true, | ||
open: { | ||
target: '_blank', | ||
}, | ||
}) | ||
} | ||
|
||
function logout() { | ||
clearSession() | ||
} | ||
|
||
onMounted(() => { | ||
if (typeof window === "undefined") { | ||
return | ||
} | ||
|
||
window.addEventListener( | ||
"message", | ||
(event) => { | ||
if (event.data.type === "auth") { | ||
fetchSession() | ||
} | ||
}, | ||
false, | ||
); | ||
}) | ||
|
||
return { | ||
loggedIn, | ||
user, | ||
session, | ||
login, | ||
logout, | ||
} | ||
} |
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.