-
Couldn't load subscription status.
- Fork 14
feat: Adds functions for dashboard APIs #52
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
098096f
feat: adds functions for dashboard APIs
jscyo 40fbb5e
fixes
jscyo cc569d4
updates interface
jscyo e200b65
fixes
jscyo 320446c
fixes
jscyo c62cf2a
updates dashboard interface
jscyo 55a5915
removes isSuspended param from Dashboard users
jscyo ac5a013
additional updates due to changes in the API spec
jscyo 079e783
implements feedback
jscyo 375f455
removes unnecessary function
jscyo a7961f3
adds additional function
jscyo 1b2e761
fixes
jscyo d5be5ff
updates
jscyo 10c0c08
updates CHANGELOG.md
jscyo 69e5223
updates CHANGELOG.md
jscyo 84f6d3f
updates version
jscyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ plugins { | |
| id 'java-library' | ||
| } | ||
|
|
||
| version = "2.19.0" | ||
| version = "2.20.0" | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
|
|
||
This file contains hidden or 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
24 changes: 24 additions & 0 deletions
24
src/main/java/io/supertokens/pluginInterface/dashboard/DashboardSessionInfo.java
This file contains hidden or 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 @@ | ||
| package io.supertokens.pluginInterface.dashboard; | ||
|
|
||
| public class DashboardSessionInfo { | ||
| public String userId; | ||
| public String sessionId; | ||
| public long timeCreated; | ||
| public long expiry; | ||
|
|
||
| public DashboardSessionInfo(String userId, String sessionId, long timeCreated, long expiry) { | ||
| this.userId = userId; | ||
| this.sessionId = sessionId; | ||
| this.timeCreated = timeCreated; | ||
| this.expiry = expiry; | ||
| } | ||
rishabhpoddar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public boolean equals(Object other) { | ||
| if (other instanceof DashboardSessionInfo) { | ||
| DashboardSessionInfo otherSessionInfo = (DashboardSessionInfo) other; | ||
| return otherSessionInfo.userId.equals(this.userId) && otherSessionInfo.timeCreated == this.timeCreated | ||
| && otherSessionInfo.sessionId.equals(this.sessionId) && otherSessionInfo.expiry == this.expiry; | ||
| } | ||
| return false; | ||
| } | ||
| } | ||
30 changes: 30 additions & 0 deletions
30
src/main/java/io/supertokens/pluginInterface/dashboard/DashboardStorage.java
This file contains hidden or 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,30 @@ | ||
| package io.supertokens.pluginInterface.dashboard; | ||
|
|
||
| import io.supertokens.pluginInterface.Storage; | ||
| import io.supertokens.pluginInterface.exceptions.StorageQueryException; | ||
| import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateEmailException; | ||
| import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateUserIdException; | ||
| import io.supertokens.pluginInterface.dashboard.exceptions.UserIdNotFoundException; | ||
|
|
||
| public interface DashboardStorage extends Storage { | ||
|
|
||
| void createNewDashboardUser(DashboardUser userInfo) throws StorageQueryException, DuplicateUserIdException, DuplicateEmailException; | ||
|
|
||
| DashboardUser getDashboardUserByEmail(String email) throws StorageQueryException; | ||
|
|
||
| DashboardUser getDashboardUserByUserId(String userId) throws StorageQueryException; | ||
|
|
||
| DashboardUser[] getAllDashboardUsers() throws StorageQueryException; | ||
|
|
||
| boolean deleteDashboardUserWithUserId(String userId) throws StorageQueryException; | ||
|
|
||
| void createNewDashboardUserSession(String userId, String sessionId, long timeCreated, long expiry) throws StorageQueryException, UserIdNotFoundException; | ||
|
|
||
| DashboardSessionInfo[] getAllSessionsForUserId(String userId) throws StorageQueryException; | ||
|
|
||
| DashboardSessionInfo getSessionInfoWithSessionId(String sessionId) throws StorageQueryException; | ||
|
|
||
| boolean revokeSessionWithSessionId(String sessionId) throws StorageQueryException; | ||
|
|
||
| void revokeExpiredSessions() throws StorageQueryException; | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/io/supertokens/pluginInterface/dashboard/DashboardUser.java
This file contains hidden or 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,26 @@ | ||
| package io.supertokens.pluginInterface.dashboard; | ||
|
|
||
| public class DashboardUser { | ||
| public final String email; | ||
| public String userId; | ||
| public long timeJoined; | ||
|
|
||
| // using transient, we tell Gson not to include this when creating a JSON | ||
| public transient final String passwordHash; | ||
|
|
||
| public DashboardUser(String userId, String email, String passwordHash, long timeJoined) { | ||
| this.userId = userId; | ||
| this.timeJoined = timeJoined; | ||
| this.email = email; | ||
| this.passwordHash = passwordHash; | ||
| } | ||
|
|
||
| public boolean equals(Object other) { | ||
| if (other instanceof DashboardUser) { | ||
| DashboardUser otherUserInfo = (DashboardUser) other; | ||
| return otherUserInfo.email.equals(this.email) && otherUserInfo.passwordHash.equals(this.passwordHash) | ||
| && otherUserInfo.userId.equals(this.userId) && otherUserInfo.timeJoined == this.timeJoined; | ||
| } | ||
| return false; | ||
| } | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/main/java/io/supertokens/pluginInterface/dashboard/exceptions/DashboardException.java
This file contains hidden or 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,6 @@ | ||
| package io.supertokens.pluginInterface.dashboard.exceptions; | ||
|
|
||
| public class DashboardException extends Exception { | ||
| private static final long serialVersionUID = -8913929332291559225L; | ||
|
|
||
| } |
6 changes: 6 additions & 0 deletions
6
...ain/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateEmailException.java
This file contains hidden or 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,6 @@ | ||
| package io.supertokens.pluginInterface.dashboard.exceptions; | ||
|
|
||
| public class DuplicateEmailException extends DashboardException{ | ||
| private static final long serialVersionUID = -5348162233516164406L; | ||
|
|
||
| } |
5 changes: 5 additions & 0 deletions
5
...in/java/io/supertokens/pluginInterface/dashboard/exceptions/DuplicateUserIdException.java
This file contains hidden or 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,5 @@ | ||
| package io.supertokens.pluginInterface.dashboard.exceptions; | ||
|
|
||
| public class DuplicateUserIdException extends DashboardException { | ||
| private static final long serialVersionUID = -7629139375718589642L; | ||
| } |
5 changes: 5 additions & 0 deletions
5
...ain/java/io/supertokens/pluginInterface/dashboard/exceptions/UserIdNotFoundException.java
This file contains hidden or 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,5 @@ | ||
| package io.supertokens.pluginInterface.dashboard.exceptions; | ||
|
|
||
| public class UserIdNotFoundException extends DashboardException { | ||
| private static final long serialVersionUID = 5010231597247117722L; | ||
| } |
16 changes: 16 additions & 0 deletions
16
src/main/java/io/supertokens/pluginInterface/dashboard/sqlStorage/DashboardSQLStorage.java
This file contains hidden or 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,16 @@ | ||
| package io.supertokens.pluginInterface.dashboard.sqlStorage; | ||
|
|
||
| import io.supertokens.pluginInterface.dashboard.DashboardStorage; | ||
| import io.supertokens.pluginInterface.dashboard.exceptions.DuplicateEmailException; | ||
| import io.supertokens.pluginInterface.dashboard.exceptions.UserIdNotFoundException; | ||
| import io.supertokens.pluginInterface.exceptions.StorageQueryException; | ||
| import io.supertokens.pluginInterface.sqlStorage.SQLStorage; | ||
| import io.supertokens.pluginInterface.sqlStorage.TransactionConnection; | ||
|
|
||
| public interface DashboardSQLStorage extends DashboardStorage, SQLStorage { | ||
|
|
||
| void updateDashboardUsersEmailWithUserId_Transaction(TransactionConnection con, String userId, String newEmail) throws StorageQueryException, DuplicateEmailException, UserIdNotFoundException; | ||
|
|
||
| void updateDashboardUsersPasswordWithUserId_Transaction(TransactionConnection con, String userId, String newPassword) throws StorageQueryException, UserIdNotFoundException; | ||
|
|
||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.