Skip to content

Commit

Permalink
Update analysis report snapshot schema
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKhatri committed Sep 7, 2023
1 parent 815d711 commit 4324861
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 217 deletions.
2 changes: 1 addition & 1 deletion apps/analysis/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class AnalysisReport(UserResource):

@staticmethod
def get_latest_snapshot(slug=None, report_id=None):
if slug is None or id is None:
if slug is None and report_id is None:
return
queryset = AnalysisReportSnapshot.objects.filter(
report__is_public=True,
Expand Down
2 changes: 1 addition & 1 deletion apps/analysis/public_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class Query:
)

@staticmethod
def resolve_analysis_report_snapshot(root, info, slug, **kwargs) -> typing.Optional[AnalysisReportSnapshot]:
def resolve_public_analysis_report_snapshot(root, info, slug, **kwargs) -> typing.Optional[AnalysisReportSnapshot]:
return AnalysisReport.get_latest_snapshot(slug=slug)
2 changes: 1 addition & 1 deletion apps/analysis/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def resolve_published_by(root, info, **_):
return resolve_user_field(root, info, 'published_by')

@staticmethod
def resolve_uploads(root, info, **_):
def resolve_files(root, info, **_):
# TODO: Maybe filter this out?
# For now
# - organization logos
Expand Down
318 changes: 104 additions & 214 deletions apps/commons/schema_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,229 +183,119 @@ class DeepExplore:

class AnalysisReport:
Snapshot = '''
query MyQuery($projectID: ID!, $reportID: ID!) {
project(id: $projectID) {
analysisReport(id: $reportID) {
id
analysis
isPublic
slug
subTitle
title
organizations {
fragment OrganizationGeneralResponse on OrganizationType {
id
title
verified
shortName
logo {
id
}
mergedAs {
id
title
shortName
mergedAs {
id
title
shortName
longName
}
}
configuration {
bodyStyle {
gap
}
containerStyle {
background {
color
opacity
}
border {
color
opacity
style
width
}
padding {
bottom
left
right
top
}
}
headerStyle {
background {
color
opacity
}
border {
color
opacity
style
width
}
padding {
bottom
left
right
top
}
subTitle {
align
color
family
size
weight
}
title {
align
color
family
size
weight
}
}
headingContentStyle {
h1 {
align
color
family
size
weight
}
h2 {
align
color
family
size
weight
}
h3 {
align
color
family
size
weight
}
h4 {
align
color
family
size
weight
}
}
imageContentStyle {
caption {
align
color
family
size
weight
}
fit
}
pageStyle {
background {
color
opacity
}
margin {
bottom
left
right
top
}
}
textContentStyle {
content {
align
color
family
size
weight
}
}
urlContentStyle {
url
}
}
containers {
id
row
column
width
height
contentConfiguration {
heading {
content
contentStyle {
content {
align
color
family
size
weight
}
}
variant
}
image {
altText
caption
}
text {
content
contentStyle {
content {
align
color
family
size
weight
}
}
}
url {
url
}
}
contentData {
data
id
upload {
logo {
id
}
}
contentStyle {
heading {
background {
color
opacity
}
border {
color
opacity
style
width
}
padding {
bottom
left
right
top
}
subTitle {
align
color
family
size
weight
}
}
fragment TextStyle on AnalysisReportTextStyleType {
align
color
family
size
weight
}
fragment PaddingStyle on AnalysisReportPaddingStyleType {
top
bottom
right
left
}
fragment BorderStyle on AnalysisReportBorderStyleType {
color
opacity
style
width
}
query MyQuery($projectID: ID!, $reportID: ID!) {
project(id: $projectID) {
analysisReport(id: $reportID) {
id
analysis
title
subTitle
slug
organizations {
...OrganizationGeneralResponse
}
title {
align
color
family
size
weight
containers {
id
clientId
row
column
width
height
contentType
style {
border {
...BorderStyle
}
padding {
...PaddingStyle
}
background {
color
opacity
}
}
contentData {
clientId
data
id
upload {
id
file {
id
}
}
}
contentConfiguration {
heading {
content
variant
style {
content {
...TextStyle
}
}
}
image {
altText
caption
style {
caption {
...TextStyle
}
fit
}
}
text {
content
style {
content {
...TextStyle
}
}
}
url {
url
}
}
}
}
}
}
}
}
}
'''

Expand Down

0 comments on commit 4324861

Please sign in to comment.