Skip to content

Commit

Permalink
add preview hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Melisa Anabella Rossi committed Aug 4, 2023
1 parent affba13 commit d5ebe40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Project/Project.router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { app } from '../server'
import * as s3Module from '../S3'
import { ManifestAttributes } from '../Manifest'
import { SDK7Scene } from '../Scene/SDK7Scene'
import { COMPOSITE_FILE_HASH } from '../Scene/composite'
import { COMPOSITE_FILE_HASH, PREVIEW_HASH } from '../Scene/utils'
import { SearchableProject } from './SearchableProject'
import { TemplateStatus } from './Project.types'

Expand Down Expand Up @@ -181,7 +181,7 @@ describe('Project Router', () => {

it('should return error', async () => {
return await server
.get(buildURL(`/projects/${projectId}/contents/preview`))
.get(buildURL(`/projects/${projectId}/contents/${PREVIEW_HASH}`))
.expect(400)
})
})
Expand All @@ -199,7 +199,7 @@ describe('Project Router', () => {

it('should return entity object', async () => {
const response = await server
.get(buildURL(`/projects/${projectId}/contents/preview`))
.get(buildURL(`/projects/${projectId}/contents/${PREVIEW_HASH}`))
.expect(200)
expect(response.body).toEqual(entity)
})
Expand Down
4 changes: 2 additions & 2 deletions src/Project/Project.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { withAuthentication, AuthRequest } from '../middleware/authentication'
import { Ownable } from '../Ownable'
import { SDK7Scene } from '../Scene/SDK7Scene'
import { COMPOSITE_FILE_HASH } from '../Scene/composite'
import { COMPOSITE_FILE_HASH, PREVIEW_HASH } from '../Scene/utils'
import { Project } from './Project.model'
import { ProjectAttributes, projectSchema } from './Project.types'
import { SearchableProject } from './SearchableProject'
Expand Down Expand Up @@ -271,7 +271,7 @@ export class ProjectRouter extends Router {
const content = server.extractFromReq(req, 'content')

// when content is preview, return entity object
if (content === 'preview') {
if (content === PREVIEW_HASH) {
try {
const { scene, project } = await getProjectManifest(projectId)
if (scene.sdk6) {
Expand Down
1 change: 1 addition & 0 deletions src/Scene/composite.ts → src/Scene/utils.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const COMPOSITE_FILE_HASH = 'bafkreicjawm77puubyf5ubmxrng4cbcmqgjpxe3qs22bspccpax7nn4zpe'
export const PREVIEW_HASH = 'bafkreiczoxhrxosdeoi4srth6wegejpwsn34bkult6rb7xp3ehejxt4qsi'

0 comments on commit d5ebe40

Please sign in to comment.