Skip to content

Commit

Permalink
Staging (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
madan-ideas2it authored Dec 20, 2024
2 parents 294d3c4 + 4ddf617 commit d310fca
Show file tree
Hide file tree
Showing 21 changed files with 476 additions and 25 deletions.
2 changes: 1 addition & 1 deletion apps/back-office/components/member-request-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MemberRequestList = (props: any) => {
};
const [listData, unVerifiedMembers] = await Promise.all([
api.get(`${API_ROUTE.PARTICIPANTS_REQUEST}?status=PENDING`, config),
api.get(`${API_ROUTE.MEMBERS}?isVerified=false&pagination=false`, config),
api.get(`${API_ROUTE.MEMBERS}?isVerified=false&pagination=false&orderBy=-createdAt`, config),
]);

const pendingMembers = listData.data.filter((item) => item.participantType === ENROLLMENT_TYPE.MEMBER);
Expand Down
3 changes: 2 additions & 1 deletion apps/web-api/prisma/fixtures/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const ProjectFactory = Factory.define<Omit<Project, 'id'>>(
}],
createdAt: faker.date.past(),
updatedAt: faker.date.recent(),
isDeleted: false
isDeleted: false,
osoProjectName: faker.random.word(),
};
}
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Project" ADD COLUMN "osoProjectName" TEXT;
176 changes: 176 additions & 0 deletions apps/web-api/prisma/oso-schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
generator client {
provider = "prisma-client-js"
output= "../../../node_modules/.prisma/oso-client"
}

datasource db {
provider = "postgresql"
url = env("OSO_DATABASE_URL")
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model artifacts_v1 {
artifact_id String?
artifact_name String?
artifact_namespace String?
artifact_source String?
artifact_source_id String?
artifact_url String?
created_at DateTime @default(now()) @db.Timestamp(6)
@@ignore
}

model code_metrics_by_project_v1 {
active_developer_count_6_months Float?
closed_issue_count_6_months Float?
commit_count_6_months Float?
contributor_count Float?
contributor_count_6_months Float?
display_name String?
event_source String?
first_commit_date String?
fork_count Int?
fulltime_developer_average_6_months Float?
last_commit_date String?
merged_pull_request_count_6_months Float?
new_contributor_count_6_months Float?
opened_issue_count_6_months Float?
opened_pull_request_count_6_months Float?
project_id String @id
project_name String?
project_namespace String?
project_source String?
repository_count Int?
star_count Int?
created_at DateTime @default(now()) @db.Timestamp(6)
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model collections_v1 {
collection_id String?
collection_name String?
collection_namespace String?
collection_source String?
description String?
display_name String?
created_at DateTime @default(now()) @db.Timestamp(6)
@@ignore
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model oso_artifactsV1 {
artifactId String?
artifactName String?
artifactNamespace String?
artifactSource String?
artifactSourceId String?
artifactUrl String?
@@ignore
}

model oso_codeMetricsByProjectV1 {
activeDeveloperCount6Months Int?
closedIssueCount6Months Int?
commitCount6Months Int?
contributorCount Int?
contributorCount6Months Int?
displayName String?
eventSource String?
firstCommitDate String?
forkCount String?
fulltimeDeveloperAverage6Months Float?
lastCommitDate String?
mergedPullRequestCount6Months Int?
newContributorCount6Months Int?
openedIssueCount6Months Int?
openedPullRequestCount6Months Int?
projectId String @id(map: "oso_codemetricsbyprojectv1_pkey")
projectName String?
projectNamespace String?
projectSource String?
repositoryCount String?
starCount String?
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model oso_collectionsV1 {
collectionId String?
collectionName String?
collectionNamespace String?
collectionSource String?
description String?
displayName String?
@@ignore
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model oso_projectsByCollectionV1 {
collectionId String?
collectionName String?
collectionNamespace String?
collectionSource String?
projectId String?
projectName String?
projectNamespace String?
projectSource String?
@@ignore
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model oso_projectsV1 {
description String?
displayName String?
projectId String?
projectName String?
projectNamespace String?
projectSource String?
@@ignore
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model projects_by_collection_v1 {
collection_id String?
collection_name String?
collection_namespace String?
collection_source String?
project_id String?
project_name String?
project_namespace String?
project_source String?
created_at DateTime @default(now()) @db.Timestamp(6)
@@ignore
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model projects_v1 {
description String?
display_name String?
project_id String?
project_name String?
project_namespace String?
project_source String?
created_at DateTime @default(now()) @db.Timestamp(6)
@@ignore
}

/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
model users_v1 {
bio String?
display_name String?
profile_picture_url String?
url String?
user_id String?
user_source String?
user_source_id String?
created_at DateTime @default(now()) @db.Timestamp(6)
@@ignore
}
1 change: 1 addition & 0 deletions apps/web-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ model Project {
updatedAt DateTime @updatedAt
isDeleted Boolean @default(false)
isFeatured Boolean? @default(false)
osoProjectName String?
projectFocusAreas ProjectFocusArea[]
contributions ProjectContribution[]
relatedQuestions DiscoveryQuestion[] @relation("ProjectRelatedDiscoveryQuestions")
Expand Down
4 changes: 3 additions & 1 deletion apps/web-api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { MemberFeedbacksModule } from './member-feedbacks/member-feedbacks.modul
import { HuskyModule } from './husky/husky.module';
import { HomeModule } from './home/home.module';
import { InternalsModule } from './internals/internals.module';
import { OsoMetricsModule } from './oso-metrics/oso-metrics.module';

@Module({
controllers: [AppController],
Expand Down Expand Up @@ -96,7 +97,8 @@ import { InternalsModule } from './internals/internals.module';
MemberFeedbacksModule,
HuskyModule,
HomeModule,
InternalsModule
InternalsModule,
OsoMetricsModule,
],
providers: [
{
Expand Down
32 changes: 26 additions & 6 deletions apps/web-api/src/focus-areas/focus-areas.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ export class FocusAreasService {
async findAll(query) {
const { type } = query;
const result = await this.prisma.focusArea.findMany({
include: {
select: {
uid: true,
title: true,
description: true,
parentUid: true,
children: this.buildQueryByLevel(4, type, query), // level denotes depth of children.
...this.buildAncestorFocusAreasFilterByType(type, query)
},
orderBy: {
createdAt: "desc"
}
},
});
return result;
}

private buildQueryByLevel(level: number, type, query) {
if (level === 0) {
return {
include: {
select: {
uid: true,
title: true,
description: true,
parentUid: true,
children: true,
...this.buildAncestorFocusAreasFilterByType(type, query)
},
Expand All @@ -34,7 +42,11 @@ export class FocusAreasService {
};
}
return {
include: {
select: {
uid: true,
title: true,
description: true,
parentUid: true,
children: this.buildQueryByLevel(level - 1, type, query),
...this.buildAncestorFocusAreasFilterByType(type, query)
},
Expand All @@ -58,7 +70,11 @@ export class FocusAreasService {
select: {
uid: true,
name: true,
logo: true
logo: {
select: {
url: true
}
}
}
}
},
Expand All @@ -79,7 +95,11 @@ export class FocusAreasService {
select: {
uid: true,
name: true,
logo: true
logo: {
select: {
url: true
}
}
}
}
},
Expand Down
27 changes: 21 additions & 6 deletions apps/web-api/src/members/members.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,21 @@ export class MemberController {
const queryParams = request.query;
const builder = new PrismaQueryBuilder(queryableFields);
const builtQuery = builder.build(queryParams);
const { name__icontains } = queryParams;
const { name__icontains, isHost, isSpeaker } = queryParams;
if (name__icontains) {
delete builtQuery.where?.name;
}
if (isHost || isSpeaker) { //Remove isHost and isSpeaker from the default query since it is to be added in eventGuest.
delete builtQuery.where?.isHost;
delete builtQuery.where?.isSpeaker;
}
builtQuery.where = {
AND: [
builtQuery.where,
this.membersService.buildNameFilters(queryParams),
this.membersService.buildRoleFilters(queryParams),
this.membersService.buildRecentMembersFilter(queryParams)
this.membersService.buildRecentMembersFilter(queryParams),
this.membersService.buildParticipationTypeFilter(queryParams)
],
};
return await this.membersService.findAll(builtQuery);
Expand All @@ -82,15 +87,20 @@ export class MemberController {
const queryParams = request.query;
const builder = new PrismaQueryBuilder(queryableFields);
const builtQuery = builder.build(queryParams);
const { name__icontains } = queryParams;
const { name__icontains, isHost, isSpeaker } = queryParams;
if (name__icontains) {
delete builtQuery.where?.name;
}
if (isHost || isSpeaker) { //Remove isHost and isSpeaker from the default query since it is to be added in eventGuest.
delete builtQuery.where?.isHost;
delete builtQuery.where?.isSpeaker;
}
builtQuery.where = {
AND: [
builtQuery.where,
this.membersService.buildNameFilters(queryParams),
this.membersService.buildRecentMembersFilter(queryParams)
this.membersService.buildRecentMembersFilter(queryParams),
this.membersService.buildParticipationTypeFilter(queryParams)
],
};
return await this.membersService.getRolesWithCount(builtQuery, queryParams);
Expand All @@ -110,16 +120,21 @@ export class MemberController {
const queryParams = request.query;
const builder = new PrismaQueryBuilder(queryableFields);
const builtQuery = builder.build(queryParams);
const { name__icontains } = queryParams;
const { name__icontains, isHost, isSpeaker } = queryParams;
if (name__icontains) {
delete builtQuery.where?.name;
}
if (isHost || isSpeaker) { //Remove isHost and isSpeaker from the default query since it is to be added in eventGuest.
delete builtQuery.where?.isHost;
delete builtQuery.where?.isSpeaker;
}
builtQuery.where = {
AND: [
builtQuery.where,
this.membersService.buildNameFilters(queryParams),
this.membersService.buildRoleFilters(queryParams),
this.membersService.buildRecentMembersFilter(queryParams)
this.membersService.buildRecentMembersFilter(queryParams),
this.membersService.buildParticipationTypeFilter(queryParams)
],
};
return await this.membersService.getMemberFilters(builtQuery);
Expand Down
Loading

0 comments on commit d310fca

Please sign in to comment.