Skip to content

Commit

Permalink
Merge pull request #256 from Giveth/staging
Browse files Browse the repository at this point in the history
Lauren's version release - v1.0.2
  • Loading branch information
mohammadranjbarz authored Dec 18, 2021
2 parents 2b6eb03 + 30e6fc0 commit c3532e2
Show file tree
Hide file tree
Showing 11 changed files with 30,064 additions and 169 deletions.
4 changes: 2 additions & 2 deletions entities/category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export class Category extends BaseEntity {
@Column('text', { unique: true, nullable: true })
name: string;

@Field()
@Field({ nullable: true })
@Column({ nullable: true })
value: string;

@Field()
@Field({ nullable: true })
@Column({ nullable: true })
source: string;

Expand Down
4 changes: 4 additions & 0 deletions entities/donation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export class Donation extends BaseEntity {
@Column()
fromWalletAddress: string;

@Field({ nullable: true })
@Column({ nullable: true })
tokenAddress?: string;

@Field()
@Column()
currency: string;
Expand Down
26 changes: 24 additions & 2 deletions entities/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ class Project extends BaseEntity {
@Column({ nullable: true })
traceCampaignId?: string;

@Index({ unique: true, where: '"givingBlocksId" IS NOT NULL' })
@Field({ nullable: true })
@Column({ default: null, nullable: true })
givingBlocksId?: string;

@Field({ nullable: true })
@Column({ default: null, nullable: true })
website?: string;

@Field({ nullable: true })
@Column({ default: null, nullable: true })
youtube?: string;

@Field({ nullable: true })
@Column({ nullable: true })
organisationId?: number;
Expand Down Expand Up @@ -225,6 +238,11 @@ class Project extends BaseEntity {
}

static addFilterQuery(query: any, filter: string, filterValue: boolean) {
if (filter === 'givingBlocksId') {
const acceptGiv = filterValue ? 'IS' : 'IS NOT';
return query.andWhere(`project.${filter} ${acceptGiv} NULL`);
}

return query.andWhere(`project.${filter} = ${filterValue}`);
}

Expand Down Expand Up @@ -263,8 +281,12 @@ class Project extends BaseEntity {

if (sortBy == 'traceCampaignId') {
// TODO: PRISMA will fix this, temporary fix inverting nulls.
let traceableDirection = { 'ASC': 'NULLS FIRST', 'DESC': 'NULLS LAST' }
query.orderBy(`project.${sortBy}`, direction, traceableDirection[direction]);
let traceableDirection = { ASC: 'NULLS FIRST', DESC: 'NULLS LAST' };
query.orderBy(
`project.${sortBy}`,
direction,
traceableDirection[direction],
);
} else {
query.orderBy(`project.${sortBy}`, direction);
}
Expand Down
Loading

0 comments on commit c3532e2

Please sign in to comment.