Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: auth middleware #90

Merged
merged 70 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
194398c
feat: implement authentication system middleware draft
kbventures Feb 26, 2025
20641a5
feat: implement authentication system middleware draft
kbventures Feb 26, 2025
d0895d3
authMiddleware V2 draft
kbventures Feb 26, 2025
3b6e934
authMiddleware V2 draft
kbventures Feb 26, 2025
60c0d73
Type
kbventures Feb 27, 2025
30ed4eb
Feat: Authoriztaion Roles Enum and added role to Session type
kbventures Feb 27, 2025
e598222
Feat: Authoriztaion Roles Enum and added role to Session type
kbventures Feb 27, 2025
d6100a3
Feat: Password and access tables and role types
kbventures Feb 27, 2025
dff6fbf
Added return to createAccessMiddleware
kbventures Mar 3, 2025
c0104f9
Feat: Updated Seed and Added Access to profile creation
kbventures Mar 3, 2025
5f6b059
Access added to profile creation
kbventures Mar 3, 2025
caba8ea
Migration update
kbventures Mar 3, 2025
06dc391
happenedAt insertedAt fields for access tables
kbventures Mar 3, 2025
9f67712
happenedAt insertedAt fields for access tables
kbventures Mar 3, 2025
2bc8f04
Fix: Switch string to ISODate
kbventures Mar 3, 2025
e2da1ed
Fix: Removed /api grouping
kbventures Mar 4, 2025
7f6602a
Removed try catch handled by gloal error handler
kbventures Mar 4, 2025
4aa101d
fix: get password by join query
lylaminju Mar 4, 2025
5c96ec2
fix: query error
lylaminju Mar 4, 2025
0ba656f
fix: modify db setup scripts to locate local db in .wrangler folder
lylaminju Mar 4, 2025
939577e
feat: insert default role as volunteer during sign-up
lylaminju Mar 5, 2025
9f1d784
Feat: Architecture change. Access will not be tracked in terms of cha…
kbventures Mar 5, 2025
1a21dbb
Feat: Architecture change. Access will not be tracked in terms of cha…
kbventures Mar 5, 2025
4ae9a07
Feat: Updated seed data to reflect new sql schema's ie access table h…
kbventures Mar 5, 2025
3663e50
Feat: Removed password db table constant to reflect new sql schema
kbventures Mar 5, 2025
bc97fef
Update: Profile data to fit new sql schema
kbventures Mar 5, 2025
8a6a9ce
Feat: refactored authentication authorization flow
kbventures Mar 5, 2025
ff66546
Bug: Routing Refactor
kbventures Mar 5, 2025
7a56693
Fix: Commented Code Until Next Version
kbventures Mar 6, 2025
61fcf5d
Fix: Commented Code Until Next Version
kbventures Mar 6, 2025
5c0a600
Fix: Renamed getId to getProfileId
kbventures Mar 6, 2025
edbe6ea
Feat: Added Email and activated fields to access table in order to re…
kbventures Mar 6, 2025
0af1ab5
Update: Insert Profile with new access table schema
kbventures Mar 6, 2025
cda0abc
Fix: Initial activatedAt should be null on profile insertion
kbventures Mar 6, 2025
df7e8d5
Fix: null value already set to default
kbventures Mar 6, 2025
ec60f46
Update Activation flow now adds activatedAt in access table
kbventures Mar 6, 2025
cbe661e
Update Activation flow now adds activatedAt in access table
kbventures Mar 6, 2025
34e9dcc
Feat: checkActivation
kbventures Mar 6, 2025
0886b63
Fix
kbventures Mar 6, 2025
d41a9da
Update: seed data to reflect changes to access schema
kbventures Mar 6, 2025
041fe0f
Testing: basic development test setup with seed data
kbventures Mar 6, 2025
27b524c
Draft: Authentication Authorization Flow Refactor
kbventures Mar 6, 2025
acc74b7
mend
kbventures Mar 6, 2025
86c47dd
mend
kbventures Mar 6, 2025
cf3e00d
Update: refactor and naming
kbventures Mar 6, 2025
50f9ba8
mend
kbventures Mar 6, 2025
abdd334
Bug: enum can't be .d.ts file
kbventures Mar 6, 2025
e8ae75a
refactor: remove unnecessary auth middleware
lylaminju Mar 10, 2025
f2fe8ce
fix: restore /teams routes
lylaminju Mar 10, 2025
e779d7f
refactor: rename access column to access_level
lylaminju Mar 10, 2025
928f238
refactor: rename variables, replace raw string with enum
lylaminju Mar 10, 2025
8c820d0
feat: add access level in session data
lylaminju Mar 10, 2025
994863d
refactor: remove redundant checkActivation
lylaminju Mar 10, 2025
c05a3dc
refactor: don't catch undefined result error in data function
lylaminju Mar 10, 2025
d3eb1dd
fix: get password from access table
lylaminju Mar 10, 2025
89e9457
feat: add middleware in /teams routes
lylaminju Mar 10, 2025
53e9c36
fix: expiry date comparing operator
lylaminju Mar 14, 2025
324d3e4
fix: move canModifyProfile into profileRoutes and only admin and volu…
lylaminju Mar 14, 2025
cead98f
fix: typo in create table access sql
lylaminju Mar 14, 2025
13c98a8
feat: set DEFAULT_TEAM_ID
lylaminju Mar 14, 2025
cc33adf
fix: d1 query functions result type
lylaminju Mar 14, 2025
37de82d
refactor: bind params formatting
lylaminju Mar 14, 2025
e4ed58f
refactor: remove activatedAt from access table
lylaminju Mar 17, 2025
9e2f52d
refactor: get both profileId and password from access table, and then…
lylaminju Mar 17, 2025
fe5353f
fix: use date-fns to calculate time
lylaminju Mar 17, 2025
30cf258
refactor: remove unnecessary query function 'getAccessLevel()'
lylaminju Mar 18, 2025
a26ebcd
Revert "refactor: remove unnecessary query function 'getAccessLevel()'"
lylaminju Mar 18, 2025
a0dd730
Resolved merge conflicts
kbventures Mar 19, 2025
cefc33d
Team Refactor / Clean Up
kbventures Mar 19, 2025
95550a1
Updated roles to current authencation authorization flow
kbventures Mar 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions migrations/0002_create-profile.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,6 @@ CREATE TABLE IF NOT EXISTS profile (
PRIMARY KEY (id)
);

DROP TABLE IF EXISTS passwords;

CREATE TABLE IF NOT EXISTS passwords (
-- The UUID of the profile this link belongs to
id TEXT NOT NULL UNIQUE COLLATE BINARY,
-- Schema version to use
-- Here it is useful if we update the password encryption algorithm in the future
schemaVersion INTEGER NOT NULL DEFAULT 1,
-- The person's account password
-- This should be propperly hashed and salted!
password TEXT NOT NULL,

FOREIGN KEY (id) REFERENCES profile(id)
);

DROP TABLE IF EXISTS profile_links;

CREATE TABLE IF NOT EXISTS profile_links (
Expand Down
21 changes: 21 additions & 0 deletions migrations/0005_access.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Migration number: 0005 2025-01-30T00:58:45.123Z

DROP TABLE IF EXISTS access;

-- Store authentication and authorization data separately from profiles
CREATE TABLE IF NOT EXISTS access (
-- The UUID of the profile this access belongs to
id TEXT NOT NULL UNIQUE COLLATE BINARY,
-- Schema version to use
schemaVersion INTEGER NOT NULL DEFAULT 1,
-- The person's access level in the system
-- This determines what actions they can perform
access_level TEXT NOT NULL CHECK(access_level IN ('admin', 'organizer', 'volunteer')),
-- The person's account password
password TEXT NOT NULL,
-- The person's email address
email TEXT NOT NULL UNIQUE,

PRIMARY KEY (id),
FOREIGN KEY (id) REFERENCES profile(id)
);
Loading