Files
d383856a4f feat: add auth middleware (#449)
* feat: add api key generator

* feat: add basic middleware

* feat: fix schema

* feat: change api

* feat: add api key method

* feat: add basic middleware

* chore: rename variables

* chore: remove console log

* feat: add auth

* chore: fix logic

* chore: fix import

* feat: add example api

* feat: make optional

* feat: add session cookie auth

* feat: add migration

* feat: fix build error

* chore: remove session route

* feat: add name and email to session

* feat: add audit to services

* style: fix type

* chore: fix auth middleware

* feat: add info to context

* chore: fix schema

* feat: add ip util

* feat: add new create endpoint

* feat: add delete endpoint

* feat: add update endpoint

* chore: remove try catch

* feat: add get one endpoint

* feat: register routes

* chore: fix param

* feat: add patch method

* feat: add get many routes and register

* chore: fix import

* feat: init share route

* chore: fix name

* feat: add delete share endpoint

* feat: add get one

* feat: add get many route

* fix: types and schema

* feat: add create handler

* feat: add update route

* feat: delete existing routes

* refactor: remove services

* chore: add prisma pagination extension

* feat: add pagination

* chore: remove import

* feat: add pagination

* chore: fix type

* chore: fix types

* refactor: remove pagination and service

* chore: add expect error comment

* chore: fix type

* feat: add summary and description

* feat: fix type

* feat: fix types

* feat: add error registry map

* style: naming changes

* chore: fix description and summary

* chore: rename

* feat: use function

* feat: add company id to path

* feat: add company id to schema

* feat: add base-x

* feat: add base 58 encoding

* feat: use new strategy

* feat: fix schema

* feat: add user access token

* feat: add tokens utility

* feat: add access token schema

* feat: refactor lib

* refactor: utils

* refactor: session cookie auth middleware

* feat: add secure hash

* feat: use secure hash

* fix: companyId in cookie

* refactor: func

* feat: add access token  middleware

* feat: remove default middlewares

* feat: add utils for tokens

* chore: upgrade packages

* chore: remove auth middleware function

* feat: add helper middleware

* feat: add new middleware

* feat: use hono helpers

* chore: remove utils

* chore: remove type

* feat: add migration for access token

* feat: access token

* feat: add without membership option

* refactor: utils

* fix: verify util

* refactor: change route

* chore: fix sidenav

* chore: rename wordings

* chore: rename router

* chore: update file name

* core: rename policies

* chore: rename apiKey to accessToken and change accessToken route to developer

* chore: working with middleware

* fix: error messages

* feat: keeping it lean and dry

* chore: remove un-used files

* chore: fix build error

* feat: some minor cleanups

* feat: return bearer token error if its invalid instead of returning session error

---------

Co-authored-by: Puru D <[email protected]>
2024-08-07 01:40:56 -05:00

28 lines
693 B
SQL

/*
Warnings:
- You are about to drop the `ApiKey` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
DROP TABLE "ApiKey";
-- CreateTable
CREATE TABLE "AccessToken" (
"id" TEXT NOT NULL,
"name" TEXT,
"active" BOOLEAN NOT NULL DEFAULT true,
"partialToken" TEXT NOT NULL,
"hashedToken" TEXT NOT NULL,
"expiresAt" TIMESTAMP(3),
"lastUsed" TIMESTAMP(3),
"userId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "AccessToken_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "AccessToken_userId_idx" ON "AccessToken"("userId");