-
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.
- Loading branch information
Showing
10 changed files
with
237 additions
and
151 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 |
---|---|---|
|
@@ -112,3 +112,6 @@ ENV/ | |
|
||
# .idea | ||
.idea/ | ||
|
||
# edgedb-py generated file | ||
generated_async_edgeql.py |
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,66 +1,50 @@ | ||
module default { | ||
# User type that implements User Protocol | ||
abstract type AbstractBaseUser { | ||
property email -> str { | ||
type EdgeBaseUser { | ||
required property email -> str { | ||
constraint exclusive; | ||
constraint regexp(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$"); | ||
} | ||
} | ||
|
||
type EdgeBaseUser extending AbstractBaseUser { | ||
required property first_name -> str; | ||
required property last_name -> str; | ||
property full_name := .first_name ++ ' ' ++ .last_name; | ||
|
||
property hashed_password -> str; | ||
property is_active -> bool; | ||
property is_superuser -> bool; | ||
property is_verified -> bool; | ||
|
||
required property username -> str { | ||
constraint exclusive; | ||
}; | ||
required property hashed_password -> str; | ||
required property is_active -> bool; | ||
required property is_superuser -> bool; | ||
required property is_verified -> bool; | ||
|
||
multi link oauth_accounts -> EdgeBaseOAuthUser { | ||
# ensures a one-to-many relationship | ||
constraint exclusive; | ||
# Deleting this Object (User) will unconditionally delete linked objects (oauth) | ||
on source delete delete target; | ||
} | ||
|
||
multi link access_tokens -> EdgeAccessTokenUser { | ||
# ensures a one-to-many relationship | ||
constraint exclusive; | ||
# Deleting this Object (User) will unconditionally delete linked objects (access) | ||
on source delete delete target; | ||
} | ||
|
||
# required property birth_date -> cal::local_date; | ||
# property age := <Age>(); | ||
# scalar type Age extending int16{ | ||
# constraint max_value(120); | ||
# constraint min_value(0); | ||
# }; | ||
} | ||
|
||
type EdgeBaseOAuthUser extending AbstractBaseUser { | ||
required property oauth_name -> str { | ||
constraint exclusive; | ||
} | ||
required property account_id -> str { | ||
constraint exclusive; | ||
type EdgeBaseOAuthUser { | ||
required property account_email -> str { | ||
constraint regexp(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$"); | ||
} | ||
required property oauth_name -> str; | ||
required property account_id -> str; | ||
required property access_token -> str; | ||
property expires_at -> int32; | ||
property refresh_token -> str; | ||
required property access_token -> str; | ||
required property account_email -> str; | ||
|
||
|
||
} | ||
|
||
type EdgeAccessTokenUser extending AbstractBaseUser { | ||
type EdgeAccessTokenUser { | ||
required property token -> str { | ||
constraint exclusive; | ||
} | ||
property created_at -> datetime { | ||
required property created_at -> datetime { | ||
default := std::datetime_current(); | ||
}; | ||
property user_id -> str; | ||
} | ||
|
||
} |
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,77 @@ | ||
CREATE MIGRATION m1eadqf3euyx5tpaogx55ntofdhuxp2vamka25sqvgzhqj7t3fukya | ||
ONTO m1nng42nf6jyq6eb2mnvcl7xfesbi5gfbrmmserku47th5pp55dqqq | ||
{ | ||
ALTER TYPE default::AbstractBaseUser { | ||
DROP PROPERTY email; | ||
}; | ||
ALTER TYPE default::EdgeAccessTokenUser { | ||
DROP PROPERTY user_id; | ||
DROP EXTENDING default::AbstractBaseUser; | ||
}; | ||
ALTER TYPE default::EdgeBaseOAuthUser DROP EXTENDING default::AbstractBaseUser; | ||
ALTER TYPE default::EdgeBaseOAuthUser { | ||
ALTER PROPERTY account_email { | ||
CREATE CONSTRAINT std::regexp(r'^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$'); | ||
}; | ||
ALTER PROPERTY account_id { | ||
DROP CONSTRAINT std::exclusive; | ||
}; | ||
ALTER PROPERTY oauth_name { | ||
DROP CONSTRAINT std::exclusive; | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER PROPERTY username { | ||
RENAME TO email; | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
DROP PROPERTY full_name; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
DROP PROPERTY first_name; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
DROP PROPERTY last_name; | ||
DROP EXTENDING default::AbstractBaseUser; | ||
}; | ||
DROP TYPE default::AbstractBaseUser; | ||
ALTER TYPE default::EdgeAccessTokenUser { | ||
ALTER PROPERTY created_at { | ||
SET REQUIRED USING (std::datetime_current()); | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER LINK access_tokens { | ||
ON SOURCE DELETE DELETE TARGET; | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER LINK oauth_accounts { | ||
ON SOURCE DELETE DELETE TARGET; | ||
}; | ||
ALTER PROPERTY email { | ||
CREATE CONSTRAINT std::regexp(r'^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$'); | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER PROPERTY hashed_password { | ||
SET REQUIRED USING (''); | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER PROPERTY is_active { | ||
SET REQUIRED USING (true); | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER PROPERTY is_superuser { | ||
SET REQUIRED USING (false); | ||
}; | ||
}; | ||
ALTER TYPE default::EdgeBaseUser { | ||
ALTER PROPERTY is_verified { | ||
SET REQUIRED USING (false); | ||
}; | ||
}; | ||
}; |
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.