Skip to content

Commit

Permalink
DOP-4414 adding projects collection as constant
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Mar 21, 2024
1 parent 2797e71 commit b82af1a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions api/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"slackViewOpenUrl": "https://slack.com/api/views.open",
"snootySecret": "SNOOTY_SECRET",
"jobQueueCollection": "JOB_QUEUE_COL_NAME",
"projectsCollection": "PROJECTS_COL_NAME",
"entitlementCollection": "USER_ENTITLEMENT_COL_NAME",
"dashboardUrl": "DASHBOARD_URL",
"repoBranchesCollection": "REPO_BRANCHES_COL_NAME",
Expand Down
3 changes: 3 additions & 0 deletions api/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"slackViewOpenUrl": "https://slack.com/api/views.open",
"snootySecret": "SNOOTY_SECRET",
"jobQueueCollection": "JOB_QUEUE_COL_NAME",
"projectsCollection": "PROJECTS_COL_NAME",
"entitlementCollection": "USER_ENTITLEMENT_COL_NAME",
"repoBranchesCollection": "REPO_BRANCHES_COL_NAME",
"docsetsCollection": "DOCSETS_COL_NAME",
Expand All @@ -37,13 +38,15 @@
"stg": {
"dbName": "pool_test",
"jobQueueCollection": "dotcom_queue",
"projectsCollection": "PROJECTS_COL_NAME",
"jobsQueueUrl": "https://sqs.us-east-2.amazonaws.com/216656347858/autobuilder-jobs-queue-dotcomstg",
"jobUpdatesQueueUrl": "https://sqs.us-east-2.amazonaws.com/216656347858/autobuilder-job-updates-queue-dotcomstg",
"parallelStgName": "dotcomstg"
},
"prd": {
"dbName": "pool",
"jobQueueCollection": "dotcom_queue",
"projectsCollection": "PROJECTS_COL_NAME",
"jobsQueueUrl": "https://sqs.us-east-2.amazonaws.com/216656347858/autobuilder-jobs-queue-dotcomprd",
"jobUpdatesQueueUrl": "https://sqs.us-east-2.amazonaws.com/216656347858/autobuilder-job-updates-queue-dotcomprd",
"parallelStgName": "dotcomprd"
Expand Down
1 change: 1 addition & 0 deletions cdk-infra/lib/constructs/api/webhook-env-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class WebhookEnvConstruct extends Construct {
SNOOTY_DB_NAME: snootyDbName,
REPO_BRANCHES_COL_NAME: repoBranchesCollection,
DOCSETS_COL_NAME: docsetsCollection,
PROJECTS_COL_NAME: 'projects',
JOB_QUEUE_COL_NAME: jobCollection,
NODE_CONFIG_DIR: './config',
JOBS_QUEUE_URL: jobsQueue.queueUrl,
Expand Down
1 change: 1 addition & 0 deletions cdk-infra/lib/constructs/worker/worker-env-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class WorkerEnvConstruct extends Construct {
REPO_BRANCHES_COL_NAME: repoBranchesCollection,
DOCSETS_COL_NAME: docsetsCollection,
JOB_QUEUE_COL_NAME: jobCollection,
PROJECTS_COL_NAME: 'projects',
CDN_INVALIDATOR_SERVICE_URL: getCdnInvalidatorUrl(env),
SEARCH_INDEX_BUCKET: 'docs-search-indexes-test',
SEARCH_INDEX_FOLDER: getSearchIndexFolder(env),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"slackViewOpenUrl": "https://slack.com/api/views.open",
"snootySecret": "SNOOTY_SECRET",
"jobQueueCollection": "JOB_QUEUE_COL_NAME",
"projectsCollection": "PROJECTS_COL_NAME",
"entitlementCollection": "USER_ENTITLEMENT_COL_NAME",
"dashboardUrl": "DASHBOARD_URL",
"repoBranchesCollection": "REPO_BRANCHES_COL_NAME",
Expand Down
1 change: 1 addition & 0 deletions cdk-infra/static/api/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"slackViewOpenUrl": "https://slack.com/api/views.open",
"snootySecret": "SNOOTY_SECRET",
"jobQueueCollection": "JOB_QUEUE_COL_NAME",
"projectsCollection": "PROJECTS_COL_NAME",
"entitlementCollection": "USER_ENTITLEMENT_COL_NAME",
"repoBranchesCollection": "REPO_BRANCHES_COL_NAME",
"docsetsCollection": "DOCSETS_COL_NAME",
Expand Down
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"githubBotPW": "q1w",
"fastlyDochubMap": "devfslydochubmap",
"entitlementCollection": "entitlements",
"projectsCollection": "projects",
"docsetsCollection": "docsets",
"MONGO_TIMEOUT_S": 1500,
"JOB_TIMEOUT_S": 900,
Expand Down
1 change: 1 addition & 0 deletions config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"githubBotPW": "q1w",
"fastlyDochubMap": "devfslydochubmap",
"entitlementCollection": "entitlements",
"projectsCollection": "projects",
"docsetsCollection": "docsets",
"MONGO_TIMEOUT_S": 1,
"JOB_TIMEOUT_S": 10,
Expand Down
11 changes: 6 additions & 5 deletions src/repositories/projectsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { IConfig } from 'config';
import { BaseRepository } from './baseRepository';
import { ILogger } from '../services/logger';

/**
* Project information from docs_metadata.projects for parser builds.
*/
//Project information from docs_metadata.projects for parser builds.

const projectsCollectionName = process.env.PROJECTS_COL_NAME || 'projects';

export class ProjectsRepository extends BaseRepository {
constructor(db: Db, config: IConfig, logger: ILogger) {
super(config, logger, 'ProjectsRepository', db.collection('projects'));
constructor(db: mongodb.Db, config: IConfig, logger: ILogger) {
super(config, logger, 'ProjectsRepository', db.collection(projectsCollectionName));
}

async getProjectEntry(name: string): Promise<mongodb.WithId<mongodb.BSON.Document> | null> {
Expand Down

0 comments on commit b82af1a

Please sign in to comment.