Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(create-site): update scripts for creating site + publishing #991

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/studio/prisma/scripts/createSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const createSite = async ({ siteName }: CreateSiteProps) => {
}),
config: jsonb({
theme: "isomer-next",
siteName: "MTI",
siteName,
logoUrl: "https://www.isomer.gov.sg/images/isomer-logo.svg",
search: undefined,
isGovernment: true,
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/features/dashboard/SiteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const SuspendableSiteList = (): JSX.Element => {
{sites.map((site) => (
<Site
siteId={site.id}
siteName={site.name}
siteName={site.config.siteName}
siteLogoUrl={generateAssetUrl(site.config.logoUrl)}
/>
))}
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/src/server/modules/site/site.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const siteRouter = router({
.selectFrom("Site")
.innerJoin("ResourcePermission", "Site.id", "ResourcePermission.siteId")
.where("ResourcePermission.userId", "=", ctx.user.id)
.select(["Site.id", "Site.name", "Site.config"])
.groupBy(["Site.id", "Site.name", "Site.config"])
.select(["Site.id", "Site.config"])
.groupBy(["Site.id", "Site.config"])
.execute()
}),
getSiteName: protectedProcedure
Expand Down
1 change: 0 additions & 1 deletion tooling/build/scripts/publishing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ async function fetchAndWriteSiteData(client: Client) {
const config = {
site: {
...configResult.rows[0].config,
siteName: configResult.rows[0].name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I recall we did this so that we store the site name as a separate column inside the DB rather than inside the JSON column, as it is used under the sites dashboard. We couldn't remove the siteName prop inside the JSON blob because then the types would not match.

I think we should still stick to storing the site name in the separate column and have this set to say "Ignore this" (until we have a good solution for the typing mismatch).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I recall we did this so that we store the site name as a separate column inside the DB rather than inside the JSON column, as it is used under the sites dashboard. We couldn't remove the siteName prop inside the JSON blob because then the types would not match.

can clarify this? not sure what the issue here is apart from the types - if it's just about the name that presents on the dashboard, we can also chagne it to read from site.config.siteName, which i thought is better because that's a "user level view" whereas the db one (site.name) is not tied under site.config

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah it would be perfect if we can read directly from site.config.siteName but not sure if there is any performance impact reading from JSON blobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok then i'll just make the change to read directly from site.config.siteName HAHA

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, see video here. re: performance impact - it's close to 0 because we already read it at present lol

Screen.Recording.2025-01-15.at.5.33.02.PM.mov

},
...configResult.rows[0].theme,
}
Expand Down
Loading