* 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>
20 lines
650 B
SQL
20 lines
650 B
SQL
|
|
-- CreateTable
|
|
CREATE TABLE "PersonalAccessToken" (
|
|
"id" TEXT NOT NULL,
|
|
"userUid" TEXT NOT NULL,
|
|
"label" TEXT NOT NULL,
|
|
"token" TEXT NOT NULL,
|
|
"expiresOn" TIMESTAMP(3),
|
|
"createdOn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedOn" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "PersonalAccessToken_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "PersonalAccessToken_token_key" ON "PersonalAccessToken"("token");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "PersonalAccessToken" ADD CONSTRAINT "PersonalAccessToken_userUid_fkey" FOREIGN KEY ("userUid") REFERENCES "User"("uid") ON DELETE CASCADE ON UPDATE CASCADE;
|