Skip to content

Commit

Permalink
Merge pull request #1013 from isomerpages/release/v0.49.0
Browse files Browse the repository at this point in the history
release(0.52.0): merge to prod
  • Loading branch information
seaerchin authored Nov 2, 2023
2 parents 2e49e8b + a520140 commit cf18014
Show file tree
Hide file tree
Showing 34 changed files with 543 additions and 132 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.52.0](https://github.com/isomerpages/isomercms-backend/compare/v0.51.0...v0.52.0)

- Feat/stagingBuildTimes [`#1008`](https://github.com/isomerpages/isomercms-backend/pull/1008)
- Fix/quickie/dbUpdate [`#1007`](https://github.com/isomerpages/isomercms-backend/pull/1007)
- fix(githubCOmmitService): add sane defaults [`#1010`](https://github.com/isomerpages/isomercms-backend/pull/1010)
- feat(media): add size information when getting media data [`#1006`](https://github.com/isomerpages/isomercms-backend/pull/1006)
- fix(reposService): simple git path cwd [`#1005`](https://github.com/isomerpages/isomercms-backend/pull/1005)
- fix: reposervice fix cwd [`#1004`](https://github.com/isomerpages/isomercms-backend/pull/1004)
- feat(media): include added time for every file [`#997`](https://github.com/isomerpages/isomercms-backend/pull/997)
- 0.51.0 [`#1001`](https://github.com/isomerpages/isomercms-backend/pull/1001)

#### [v0.51.0](https://github.com/isomerpages/isomercms-backend/compare/v0.50.0...v0.51.0)

> 30 October 2023
- feat(quickie): correct staging url [`#999`](https://github.com/isomerpages/isomercms-backend/pull/999)
- feat(GH<->GGs): Repair GGs [`#996`](https://github.com/isomerpages/isomercms-backend/pull/996)
- 0.50.0 to develop [`#993`](https://github.com/isomerpages/isomercms-backend/pull/993)
Expand All @@ -31,12 +44,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- build(deps-dev): bump @babel/traverse from 7.22.8 to 7.23.2 [`#984`](https://github.com/isomerpages/isomercms-backend/pull/984)
- release/v0.48.0 [`#979`](https://github.com/isomerpages/isomercms-backend/pull/979)
- feat(staging-id): add column to store the id [`#983`](https://github.com/isomerpages/isomercms-backend/pull/983)
- Fix: collaborators service tests [`#978`](https://github.com/isomerpages/isomercms-backend/pull/978)

#### [v0.48.0](https://github.com/isomerpages/isomercms-backend/compare/v0.47.0...v0.48.0)

> 18 October 2023
- Fix: collaborators service tests [`#978`](https://github.com/isomerpages/isomercms-backend/pull/978)
- chore(commitService): proper naming [`#975`](https://github.com/isomerpages/isomercms-backend/pull/975)
- Feat/is 585 govt sgid login rollout [`#976`](https://github.com/isomerpages/isomercms-backend/pull/976)
- test(quickie): unit tests [`#973`](https://github.com/isomerpages/isomercms-backend/pull/973)
Expand Down
1 change: 1 addition & 0 deletions kishore-test-dev-emil/kishore-test-dev-emil
Submodule kishore-test-dev-emil added at 3478fc
1 change: 1 addition & 0 deletions pa-corp/pa-corp
Submodule pa-corp added at 1c144c
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isomercms",
"version": "0.51.0",
"version": "0.52.0",
"private": true,
"scripts": {
"build": "tsc -p tsconfig.build.json",
Expand Down Expand Up @@ -73,7 +73,7 @@
"module-alias": "^2.2.2",
"moment-timezone": "^0.5.35",
"morgan": "~1.10.0",
"neverthrow": "^4.3.1",
"neverthrow": "^6.1.0",
"nocache": "^3.0.4",
"node-dig-dns": "^0.3.3",
"otplib": "^12.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/constants/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const FEATURE_FLAGS = {
IS_BUILD_TIMES_REDUCTION_ENABLED: "is_build_times_reduction_enabled",
IS_GGS_ENABLED: "is_ggs_enabled",
IS_SHOW_STAGING_BUILD_STATUS_ENABLED: "is_show_staging_build_status_enabled",
} as const
3 changes: 3 additions & 0 deletions src/fixtures/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ export const MEDIA_DIR: MediaFile = {
type: "dir",
sha: MEDIA_FILE_SHA,
path: `${MEDIA_DIRECTORY_NAME}/directory`,
size: 0,
}

const BASE_MEDIA_FILE: MediaFile = {
name: MEDIA_FILE_NAME,
type: "file",
sha: MEDIA_FILE_SHA,
path: `${MEDIA_DIRECTORY_NAME}/${MEDIA_FILE_NAME}`,
size: 1234,
}

export const NESTED_MEDIA_FILE: MediaFile = {
Expand All @@ -34,6 +36,7 @@ export const SVG_FILE = {
const BASE_INPUT = {
siteName: MEDIA_SITE_NAME,
directoryName: MEDIA_DIRECTORY_NAME,
addedTime: 0,
}

export const DIR_INPUT = {
Expand Down
3 changes: 3 additions & 0 deletions src/fixtures/repoInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const MOCK_STAGING_URL_CONFIGYML: NonNullable<
export const MOCK_STAGING_URL_DB: NonNullable<
ConfigYmlData["staging"]
> = Brand.fromString("https://repo-staging-db.netlify.app")
export const MOCK_STAGING_LITE_URL_DB: NonNullable<
ConfigYmlData["staging"]
> = Brand.fromString("https://repo-staging-lite-db.netlify.app")

export const MOCK_PRODUCTION_URL_GITHUB: NonNullable<
ConfigYmlData["prod"]
Expand Down
6 changes: 6 additions & 0 deletions src/integration/NotificationOnEditHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NotificationOnEditHandler } from "@middleware/notificationOnEditHandler
import UserSessionData from "@classes/UserSessionData"

import {
Deployment,
Notification,
Repo,
Reviewer,
Expand Down Expand Up @@ -41,6 +42,7 @@ import { UnlinkedPageService } from "@root/services/fileServices/MdPageServices/
import { CollectionYmlService } from "@root/services/fileServices/YmlFileServices/CollectionYmlService"
import { ConfigService } from "@root/services/fileServices/YmlFileServices/ConfigService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import DeploymentsService from "@root/services/identity/DeploymentsService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import RepoService from "@services/db/RepoService"
Expand Down Expand Up @@ -121,6 +123,9 @@ const reviewRequestService = new ReviewRequestService(
configService,
sequelize
)
const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
// Using a mock SitesCacheService as the actual service has setInterval
// which causes tests to not exit.
const MockSitesCacheService = {
Expand All @@ -136,6 +141,7 @@ const sitesService = new SitesService({
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
deploymentsService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
7 changes: 7 additions & 0 deletions src/integration/Notifications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import simpleGit from "simple-git"
import request from "supertest"

import {
Deployment,
Notification,
Repo,
Reviewer,
Expand Down Expand Up @@ -48,6 +49,7 @@ import { ConfigService } from "@root/services/fileServices/YmlFileServices/Confi
import { ConfigYmlService } from "@root/services/fileServices/YmlFileServices/ConfigYmlService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import CollaboratorsService from "@root/services/identity/CollaboratorsService"
import DeploymentsService from "@root/services/identity/DeploymentsService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import SitesService from "@root/services/identity/SitesService"
Expand Down Expand Up @@ -126,6 +128,10 @@ const reviewRequestService = new ReviewRequestService(
configService,
sequelize
)

const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
// Using a mock SitesCacheService as the actual service has setInterval
// which causes tests to not exit.
const MockSitesCacheService = {
Expand All @@ -141,6 +147,7 @@ const sitesService = new SitesService({
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
deploymentsService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
8 changes: 5 additions & 3 deletions src/integration/Privatisation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ const reviewRequestService = new ReviewRequestService(
configService,
sequelize
)

const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
// Using a mock SitesCacheService as the actual service has setInterval
// which causes tests to not exit.
const MockSitesCacheService = {
Expand All @@ -172,16 +176,14 @@ const sitesService = new SitesService({
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
deploymentsService,
})
const navYmlService = new NavYmlService({
gitHubService,
})
const homepagePageService = new HomepagePageService({
gitHubService,
})
const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})

const identityAuthService = getIdentityAuthService(gitHubService)
const collaboratorsService = new CollaboratorsService({
Expand Down
5 changes: 5 additions & 0 deletions src/integration/Reviews.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import { UnlinkedPageService } from "@root/services/fileServices/MdPageServices/
import { CollectionYmlService } from "@root/services/fileServices/YmlFileServices/CollectionYmlService"
import { ConfigService } from "@root/services/fileServices/YmlFileServices/ConfigService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import DeploymentsService from "@root/services/identity/DeploymentsService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import { ReviewRequestDto } from "@root/types/dto/review"
Expand Down Expand Up @@ -161,6 +162,9 @@ const reviewRequestService = new ReviewRequestService(
configService,
sequelize
)
const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
// Using a mock SitesCacheService as the actual service has setInterval
// which causes tests to not exit.
const MockSitesCacheService = {
Expand All @@ -176,6 +180,7 @@ const sitesService = new SitesService({
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
deploymentsService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
8 changes: 5 additions & 3 deletions src/integration/Sites.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ const reviewRequestService = new ReviewRequestService(
configService,
sequelize
)

const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
// Using a mock SitesCacheService as the actual service has setInterval
// which causes tests to not exit.
const MockSitesCacheService = {
Expand All @@ -141,6 +145,7 @@ const sitesService = new SitesService({
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
deploymentsService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand All @@ -162,9 +167,6 @@ const reposService = new ReposService({
repository: Repo,
simpleGit: simpleGit(),
})
const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
const launchClient = new LaunchClient()
const launchesService = new LaunchesService({
launchesRepository: Launch,
Expand Down
10 changes: 2 additions & 8 deletions src/routes/formsg/formsgGGsRepair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import {
DecryptedFile,
} from "@opengovsg/formsg-sdk/dist/types"
import express, { RequestHandler } from "express"
import {
ResultAsync,
combineWithAllErrors,
errAsync,
fromPromise,
okAsync,
} from "neverthrow"
import { ResultAsync, errAsync, fromPromise, okAsync } from "neverthrow"

import { config } from "@config/config"

Expand Down Expand Up @@ -172,7 +166,7 @@ export class FormsgGGsRepairRouter {
})

let errors: GitFileSystemError[] = []
combineWithAllErrors(repairs)
ResultAsync.combineWithAllErrors(repairs)
.orElse((error) => {
errors = error
// send one final email about success and failures
Expand Down
24 changes: 24 additions & 0 deletions src/routes/v2/authenticated/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ProdPermalink, StagingPermalink } from "@root/types/pages"
import { PreviewInfo } from "@root/types/previewInfo"
import { RepositoryData } from "@root/types/repoInfo"
import { SiteInfo, SiteLaunchDto } from "@root/types/siteInfo"
import { StagingBuildStatus } from "@root/types/stagingBuildStatus"
import type SitesService from "@services/identity/SitesService"

type SitesRouterProps = {
Expand Down Expand Up @@ -169,6 +170,23 @@ export class SitesRouter {
.getSitesPreview(req.body.sites, res.locals.userSessionData)
.then((previews) => res.status(200).json(previews))

getUserStagingSiteBuildStatus: RequestHandler<
{ siteName: string },
StagingBuildStatus | ResponseErrorBody,
never,
never,
{ userWithSiteSessionData: UserWithSiteSessionData }
> = async (req, res) => {
const { userWithSiteSessionData } = res.locals
const result = await this.sitesService.getUserStagingSiteBuildStatus(
userWithSiteSessionData
)
if (result.isOk()) {
return res.status(200).json(result.value)
}
return res.status(404).json({ message: "Unable to get staging status" })
}

getRouter() {
const router = express.Router({ mergeParams: true })

Expand Down Expand Up @@ -210,6 +228,12 @@ export class SitesRouter {
this.authorizationMiddleware.verifySiteAdmin,
attachReadRouteHandlerWrapper(this.launchSite)
)
router.get(
"/:siteName/getStagingBuildStatus",
attachSiteHandler,
this.authorizationMiddleware.verifySiteMember,
attachReadRouteHandlerWrapper(this.getUserStagingSiteBuildStatus)
)

// The /sites/preview is a POST endpoint as the frontend sends
// a list of sites to obtain previews for. This is to support
Expand Down
8 changes: 5 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ const reviewRequestService = new ReviewRequestService(
const cacheRefreshInterval = 1000 * 60 * 5 // 5 minutes
const sitesCacheService = new SitesCacheService(cacheRefreshInterval)
const previewService = new PreviewService()
const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})
const sitesService = new SitesService({
siteRepository: Site,
gitHubService,
Expand All @@ -242,14 +245,13 @@ const sitesService = new SitesService({
reviewRequestService,
sitesCacheService,
previewService,
deploymentsService,
})
const reposService = new ReposService({
repository: Repo,
simpleGit: simpleGitInstance,
})
const deploymentsService = new DeploymentsService({
deploymentsRepository: Deployment,
})

const launchClient = new LaunchClient()
const launchesService = new LaunchesService({
launchesRepository: Launch,
Expand Down
Loading

0 comments on commit cf18014

Please sign in to comment.