Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 21 additions & 7 deletions libs/bootstrap/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* хука для Node.js HTTP-слоя (this.raw). Приведение к 'any' здесь является легитимным решением
* для динамического monkey-patching-а.
*/
.addHook('onRequest', (request: any, reply: any, done) => {

Check warning on line 70 in libs/bootstrap/src/bootstrap.ts

View workflow job for this annotation

GitHub Actions / Lint & Test

Unexpected any. Specify a different type

Check warning on line 70 in libs/bootstrap/src/bootstrap.ts

View workflow job for this annotation

GitHub Actions / Lint & Test

Unexpected any. Specify a different type

Check warning on line 70 in libs/bootstrap/src/bootstrap.ts

View workflow job for this annotation

GitHub Actions / Lint & Test

Unexpected any. Specify a different type

Check warning on line 70 in libs/bootstrap/src/bootstrap.ts

View workflow job for this annotation

GitHub Actions / Lint & Test

Unexpected any. Specify a different type
reply.setHeader = function (key: string, value: string) {
return this.raw.setHeader(key, value);
};
Expand Down Expand Up @@ -100,6 +100,10 @@
},
});

const isProduction = configService.get('NODE_ENV') === 'production';
const domain = configService.get('DOMAIN');
const stage = configService.get('STAGE_DOMAIN');

if (apiPrefix) {
app.setGlobalPrefix(apiPrefix);
}
Expand All @@ -118,9 +122,6 @@
if (swaggerOptions) {
const { path = 'docs', ...metadata } = swaggerOptions;

const domain = configService.get('DOMAIN');
const stage = configService.get('STAGE_DOMAIN');

const fullOptions = {
...metadata,
path,
Expand All @@ -135,14 +136,27 @@
}
if (useCookieParser) {
const secret = configService.getOrThrow('COOKIE_SECRET');
await app.register(fastifyCookie, { secret });
const domainCookie = domain ? `.${domain}` : undefined;
await app.register(fastifyCookie, {
secret,
parseOptions: {
httpOnly: true,
sameSite: 'lax',
signed: true,
secure: isProduction,
path: '/',
domain: domainCookie,
},
});
await app.register(fastifyCsrf, {
cookieOpts: {
signed: true,
httpOnly: true,
sameSite: 'strict',
secure: configService.getOrThrow('NODE_ENV') === 'production',
sameSite: 'lax',
secure: isProduction,
path: '/',
domain: domainCookie,
},
sessionPlugin: '@fastify/cookie',
});
}
if (setupApp) {
Expand Down
75 changes: 75 additions & 0 deletions migrations/0006_add_issue.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
CREATE TYPE "base"."issue_type" AS ENUM ('bug', 'task', 'epic');

CREATE TYPE "base"."priority" AS ENUM ('critical', 'low', 'medium', 'high');

CREATE TABLE
"base"."issues" (
"id" text PRIMARY KEY NOT NULL,
"title" varchar(255) NOT NULL,
"description" text,
"description_html" text,
"priority" "priority" DEFAULT 'medium' NOT NULL,
"type" "issue_type" DEFAULT 'task' NOT NULL,
"area_id" text NOT NULL,
"state_id" text,
"position" integer DEFAULT 0,
"assignee_id" text,
"reporter_id" text,
"parent_id" text,
"story_points" integer,
"due_date" timestamp
with
time zone,
"created_at" timestamp
with
time zone DEFAULT now () NOT NULL,
"updated_at" timestamp
with
time zone DEFAULT now () NOT NULL,
"deleted_at" timestamp
with
time zone,
CONSTRAINT "no_self_parent" CHECK (
"base"."issues"."parent_id" IS NULL
OR "base"."issues"."parent_id" != "base"."issues"."id"
)
);

ALTER TABLE "base"."issues" ADD CONSTRAINT "issues_area_id_areas_id_fk" FOREIGN KEY ("area_id") REFERENCES "base"."areas" ("id") ON DELETE cascade ON UPDATE no action;

ALTER TABLE "base"."issues" ADD CONSTRAINT "issues_state_id_states_id_fk" FOREIGN KEY ("state_id") REFERENCES "base"."states" ("id") ON DELETE set null ON UPDATE no action;

ALTER TABLE "base"."issues" ADD CONSTRAINT "issues_assignee_id_users_id_fk" FOREIGN KEY ("assignee_id") REFERENCES "base"."users" ("id") ON DELETE set null ON UPDATE no action;

ALTER TABLE "base"."issues" ADD CONSTRAINT "issues_reporter_id_users_id_fk" FOREIGN KEY ("reporter_id") REFERENCES "base"."users" ("id") ON DELETE set null ON UPDATE no action;

ALTER TABLE "base"."issues" ADD CONSTRAINT "issues_parent_id_issues_id_fk" FOREIGN KEY ("parent_id") REFERENCES "base"."issues" ("id") ON DELETE set null ON UPDATE no action;

CREATE INDEX "idx_issue_area_state" ON "base"."issues" USING btree ("area_id", "state_id", "position")
WHERE
"base"."issues"."deleted_at" IS NULL;

CREATE INDEX "idx_issue_assignee" ON "base"."issues" USING btree ("assignee_id")
WHERE
"base"."issues"."deleted_at" IS NULL;

CREATE INDEX "idx_issue_parent" ON "base"."issues" USING btree ("parent_id")
WHERE
"base"."issues"."deleted_at" IS NULL;

CREATE INDEX "idx_issue_priority" ON "base"."issues" USING btree ("priority")
WHERE
"base"."issues"."deleted_at" IS NULL;

CREATE INDEX "idx_issue_type" ON "base"."issues" USING btree ("type")
WHERE
"base"."issues"."deleted_at" IS NULL;

CREATE INDEX "idx_issue_search" ON "base"."issues" USING gin (
to_tsvector (
'english',
COALESCE("title", '') || ' ' || COALESCE("description", '')
)
)
WHERE
"base"."issues"."deleted_at" IS NULL;
Loading
Loading