feat: adding support for hopp-cli in self-host Hoppscotch (#4079)
* feat: created a new table to store user PATs * chore: renamed UserTokens table name to PersonalAccessToken * chore: added unique property to token column * chore: made expiresOn field optional * chore: created access-token module * feat: created access-token rest routes * chore: created a new auth guard for PATs * chore: scaffolded routes in team collection and environments modules for CLI * chore: created method to update lastUsedOn property for accessTokens * chore: created interceptor to update lastUsedOn property of PAT * feat: interceptor to update lastUpdatedOn property complete * chore: removed unused imports in access-token interceptor * chore: moved routes to fetch collection and environment into access-token module * feat: added routes to fetch collections and environments for CLI * chore: modified access-token interceptor * chore: removed log statement from interceptor * chore: added team member checking logic to ForCLI methods in team collection and environments module * chore: changed return error messages to those defined in spec * chore: added comments to all service methods * chore: removed unused imports * chore: updated testcases for team-environments module service file * chore: added and updated testcases * chore: removed unneseccary SQL from auto-generated migration sql for PAT * chore: remobed JWTAuthGuard from relevant routes in PAT controllers file * chore: modified token for auth in PATAuthGuard * chore: changed error codes in some certain service methods in access-token module * feat: worked on feedback for PR review * chore: renamed service method in access-token module * chore: removed console log statements * chore: modified cli error type * test: fix broken test case * chore: changed target of hopp-old-backend to prod --------- Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
This commit is contained in:
@@ -89,25 +89,26 @@ model TeamEnvironment {
|
||||
}
|
||||
|
||||
model User {
|
||||
uid String @id @default(cuid())
|
||||
displayName String?
|
||||
email String? @unique
|
||||
photoURL String?
|
||||
isAdmin Boolean @default(false)
|
||||
refreshToken String?
|
||||
providerAccounts Account[]
|
||||
VerificationToken VerificationToken[]
|
||||
settings UserSettings?
|
||||
UserHistory UserHistory[]
|
||||
UserEnvironments UserEnvironment[]
|
||||
userCollections UserCollection[]
|
||||
userRequests UserRequest[]
|
||||
currentRESTSession Json?
|
||||
currentGQLSession Json?
|
||||
lastLoggedOn DateTime?
|
||||
createdOn DateTime @default(now()) @db.Timestamp(3)
|
||||
invitedUsers InvitedUsers[]
|
||||
shortcodes Shortcode[]
|
||||
uid String @id @default(cuid())
|
||||
displayName String?
|
||||
email String? @unique
|
||||
photoURL String?
|
||||
isAdmin Boolean @default(false)
|
||||
refreshToken String?
|
||||
providerAccounts Account[]
|
||||
VerificationToken VerificationToken[]
|
||||
settings UserSettings?
|
||||
UserHistory UserHistory[]
|
||||
UserEnvironments UserEnvironment[]
|
||||
userCollections UserCollection[]
|
||||
userRequests UserRequest[]
|
||||
currentRESTSession Json?
|
||||
currentGQLSession Json?
|
||||
lastLoggedOn DateTime?
|
||||
createdOn DateTime @default(now()) @db.Timestamp(3)
|
||||
invitedUsers InvitedUsers[]
|
||||
shortcodes Shortcode[]
|
||||
personalAccessTokens PersonalAccessToken[]
|
||||
}
|
||||
|
||||
model Account {
|
||||
@@ -219,3 +220,14 @@ model InfraConfig {
|
||||
createdOn DateTime @default(now()) @db.Timestamp(3)
|
||||
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
||||
}
|
||||
|
||||
model PersonalAccessToken {
|
||||
id String @id @default(cuid())
|
||||
userUid String
|
||||
user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
|
||||
label String
|
||||
token String @unique @default(uuid())
|
||||
expiresOn DateTime? @db.Timestamp(3)
|
||||
createdOn DateTime @default(now()) @db.Timestamp(3)
|
||||
updatedOn DateTime @updatedAt @db.Timestamp(3)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user