-
Notifications
You must be signed in to change notification settings - Fork 3
DRA-283-Lead-Generator-PDF-System #375
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
9 commits
Select commit
Hold shift + click to select a range
96f3f14
feat: add lead generator PDF system with gated/open download support
mustafaneguib 4dbc38a
Potential fix for pull request finding 'CodeQL / Uncontrolled data us…
mustafaneguib d9b5045
Potential fix for pull request finding 'CodeQL / Uncontrolled data us…
mustafaneguib 75b88bd
fix(lead-generators): address PR #375 Copilot security and quality re…
mustafaneguib 5177867
feat(types): add ILeadGenerator and ILeadGeneratorLead TypeScript int…
mustafaneguib be6cd52
refactor(layouts): migrate app.vue, default.vue and project.vue to la…
mustafaneguib 0bf4d6e
refactor(components): migrate all 43 components to lang="ts" with typ…
mustafaneguib 6b9a96b
refactor(pages): migrate all 104 pages to lang="ts" with typed state …
mustafaneguib f565439
feat(typescript): complete TypeScript migration phase 4 - eliminate r…
mustafaneguib 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
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
64 changes: 64 additions & 0 deletions
64
backend/src/migrations/1775900000000-CreateLeadGeneratorTables.ts
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,64 @@ | ||
| import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
|
||
| export class CreateLeadGeneratorTables1775900000000 implements MigrationInterface { | ||
| name = 'CreateLeadGeneratorTables1775900000000' | ||
|
|
||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| CREATE TABLE IF NOT EXISTS "dra_lead_generators" ( | ||
| "id" SERIAL NOT NULL, | ||
| "title" character varying(255) NOT NULL, | ||
| "slug" character varying(255) NOT NULL, | ||
| "description" text, | ||
| "file_name" character varying(500) NOT NULL, | ||
| "original_file_name" character varying(500) NOT NULL, | ||
| "is_gated" boolean NOT NULL DEFAULT true, | ||
| "is_active" boolean NOT NULL DEFAULT true, | ||
| "view_count" integer NOT NULL DEFAULT 0, | ||
| "download_count" integer NOT NULL DEFAULT 0, | ||
| "created_at" TIMESTAMPTZ NOT NULL DEFAULT now(), | ||
| "updated_at" TIMESTAMPTZ NOT NULL DEFAULT now(), | ||
| CONSTRAINT "PK_dra_lead_generators" PRIMARY KEY ("id") | ||
| ) | ||
| `); | ||
|
|
||
| await queryRunner.query(` | ||
| CREATE UNIQUE INDEX IF NOT EXISTS "UQ_dra_lead_generators_slug" | ||
| ON "dra_lead_generators" ("slug") | ||
| `); | ||
|
|
||
| await queryRunner.query(` | ||
| CREATE TABLE IF NOT EXISTS "dra_lead_generator_leads" ( | ||
| "id" SERIAL NOT NULL, | ||
| "lead_generator_id" integer NOT NULL, | ||
| "full_name" character varying(255), | ||
| "email" character varying(255) NOT NULL, | ||
| "company" character varying(255), | ||
| "phone" character varying(50), | ||
| "job_title" character varying(255), | ||
| "ip_address" character varying(45), | ||
| "created_at" TIMESTAMPTZ NOT NULL DEFAULT now(), | ||
| CONSTRAINT "PK_dra_lead_generator_leads" PRIMARY KEY ("id") | ||
| ) | ||
| `); | ||
|
|
||
| await queryRunner.query(` | ||
| DO $$ BEGIN | ||
| ALTER TABLE "dra_lead_generator_leads" | ||
| ADD CONSTRAINT "FK_dra_lead_generator_leads_generator" | ||
| FOREIGN KEY ("lead_generator_id") | ||
| REFERENCES "dra_lead_generators"("id") | ||
| ON DELETE CASCADE | ||
| ON UPDATE NO ACTION; | ||
| EXCEPTION | ||
| WHEN duplicate_object THEN null; | ||
| END $$; | ||
| `); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(`DROP TABLE IF EXISTS "dra_lead_generator_leads"`); | ||
| await queryRunner.query(`DROP INDEX IF EXISTS "UQ_dra_lead_generators_slug"`); | ||
| await queryRunner.query(`DROP TABLE IF EXISTS "dra_lead_generators"`); | ||
| } | ||
| } |
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,51 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| OneToMany, | ||
| PrimaryGeneratedColumn, | ||
| UpdateDateColumn, | ||
| } from 'typeorm'; | ||
| import { DRALeadGeneratorLead } from './DRALeadGeneratorLead.js'; | ||
|
|
||
| @Entity('dra_lead_generators') | ||
| export class DRALeadGenerator { | ||
| @PrimaryGeneratedColumn() | ||
| id!: number; | ||
|
|
||
| @Column({ type: 'varchar', length: 255 }) | ||
| title!: string; | ||
|
|
||
| @Column({ type: 'varchar', length: 255, unique: true }) | ||
| slug!: string; | ||
|
|
||
| @Column({ type: 'text', nullable: true }) | ||
| description!: string | null; | ||
|
|
||
| @Column({ type: 'varchar', length: 500 }) | ||
| file_name!: string; | ||
|
|
||
| @Column({ type: 'varchar', length: 500 }) | ||
| original_file_name!: string; | ||
|
|
||
| @Column({ type: 'boolean', default: true }) | ||
| is_gated!: boolean; | ||
|
|
||
| @Column({ type: 'boolean', default: true }) | ||
| is_active!: boolean; | ||
|
|
||
| @Column({ type: 'int', default: 0 }) | ||
| view_count!: number; | ||
|
|
||
| @Column({ type: 'int', default: 0 }) | ||
| download_count!: number; | ||
|
|
||
| @CreateDateColumn({ type: 'timestamptz' }) | ||
| created_at!: Date; | ||
|
|
||
| @UpdateDateColumn({ type: 'timestamptz' }) | ||
| updated_at!: Date; | ||
|
|
||
| @OneToMany(() => DRALeadGeneratorLead, (lead) => lead.lead_generator) | ||
| leads!: DRALeadGeneratorLead[]; | ||
| } |
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,44 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| JoinColumn, | ||
| ManyToOne, | ||
| PrimaryGeneratedColumn, | ||
| Relation, | ||
| } from 'typeorm'; | ||
| import { DRALeadGenerator } from './DRALeadGenerator.js'; | ||
|
|
||
| @Entity('dra_lead_generator_leads') | ||
| export class DRALeadGeneratorLead { | ||
| @PrimaryGeneratedColumn() | ||
| id!: number; | ||
|
|
||
| @Column({ type: 'int' }) | ||
| lead_generator_id!: number; | ||
|
|
||
| @Column({ type: 'varchar', length: 255, nullable: true }) | ||
| full_name!: string | null; | ||
|
|
||
| @Column({ type: 'varchar', length: 255 }) | ||
| email!: string; | ||
|
|
||
| @Column({ type: 'varchar', length: 255, nullable: true }) | ||
| company!: string | null; | ||
|
|
||
| @Column({ type: 'varchar', length: 50, nullable: true }) | ||
| phone!: string | null; | ||
|
|
||
| @Column({ type: 'varchar', length: 255, nullable: true }) | ||
| job_title!: string | null; | ||
|
|
||
| @Column({ type: 'varchar', length: 45, nullable: true }) | ||
| ip_address!: string | null; | ||
|
|
||
| @CreateDateColumn({ type: 'timestamptz' }) | ||
| created_at!: Date; | ||
|
|
||
| @ManyToOne(() => DRALeadGenerator, (lg) => lg.leads, { onDelete: 'CASCADE' }) | ||
| @JoinColumn({ name: 'lead_generator_id' }) | ||
| lead_generator!: Relation<DRALeadGenerator>; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new lead generator entity imports were appended onto existing import lines, resulting in multiple imports on a single line. This is easy to miss in reviews and can create noisy diffs/merge conflicts. Please split these into separate properly formatted import statements.