Skip to content

Commit

Permalink
add qfStrategy to qfRounds (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 authored Jan 13, 2025
1 parent 039d808 commit 9d61941
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
24 changes: 24 additions & 0 deletions migration/1736719823637-MarkRoundsStrategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class MarkRoundsStrategy1736719823637 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE TYPE "qf_strategy_enum" AS ENUM ('cocm', 'regular');
`);

await queryRunner.query(`
ALTER TABLE "qf_round"
ADD COLUMN "qfStrategy" "qf_strategy_enum" DEFAULT 'regular';
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE "qf_round"
DROP COLUMN "qfStrategy";
`);
await queryRunner.query(`
DROP TYPE "qf_strategy_enum";
`);
}
}
27 changes: 26 additions & 1 deletion src/entities/qfRound.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Field, ID, ObjectType, Int, Float } from 'type-graphql';
import {
Field,
ID,
ObjectType,
Int,
Float,
registerEnumType,
} from 'type-graphql';
import {
PrimaryGeneratedColumn,
Column,
Expand All @@ -13,6 +20,15 @@ import {
import { Project } from './project';
import { Donation } from './donation';

export enum QfStrategyEnum {
Cocm = 'cocm',
Regular = 'regular',
}

registerEnumType(QfStrategyEnum, {
name: 'QfStrategyEnum', // Name to expose in GraphQL schema
});

@Entity()
@ObjectType()
export class QfRound extends BaseEntity {
Expand Down Expand Up @@ -89,6 +105,15 @@ export class QfRound extends BaseEntity {
@Column()
endDate: Date;

@Field(_type => QfStrategyEnum, { nullable: true })
@Column({
type: 'enum',
enum: QfStrategyEnum,
default: QfStrategyEnum.Regular,
nullable: true,
})
qfStrategy?: QfStrategyEnum;

@Field(_type => String, { nullable: true })
@Column('text', { nullable: true })
bannerBgImage: string;
Expand Down
9 changes: 9 additions & 0 deletions src/server/adminJs/tabs/qfRoundTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,15 @@ export const qfRoundTab = {
show: adminJs.bundle('./components/ProjectsInQfRound'),
},
},
qfStrategy: {
isVisible: {
filter: false,
list: false,
show: true,
new: true,
edit: true,
},
},
bannerBgImage: {
isVisible: {
filter: false,
Expand Down

0 comments on commit 9d61941

Please sign in to comment.