-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Working admin, broken views * reset schema to accomodate max flexibility using json field type * Refactor db schema to accomodate max flexibility using json fields * create views from user-submitted data from which to create UI elements in front-end * Auto-generate ERD diagram * reinstate theme table (instead of view) * update views * annotate tables * remove optional nature of study slug * convert metrics id into compound id * convert metrics_metadata id into composite id and add map_display index * remove unnecessary index * add missing index to geometries table * continue removing unnecessary index specifications * Add step to lint codebase for unstaged ERDs * Update ERD * Upload failed prisma builds * Use slugs rather than IDs, refactor * Clarify terminology in readme * Refine models * Add prototyping data * Continue example queries * More examples * Add functions and seed Still just for dev, need to be moved to migration and seed.ts * Rm schema * Rm shadowDatabaseUrl As per prisma/prisma#19234 (comment) * Create migration for updated models * Create migration for functions * Working start to seed * Undo admin logic * Revert "Working admin, broken views" This reverts commit 332a54a. * Cleanup * Cascade deletes, delete study before ingestion * Squash migrations * Update log * Stage progress * Refine * Update to store src_field in aggregations * Add pre-aggregation to ingestion * Add units & description to aggregations * Change term * Rename field * Continue buildout * Working ingestion * Add ingestion data * Disable ERD generation * Update model to fit new DB schema * Update spatial queries * Fix build * Fix attribute name * Tighten typings to avoid build issues * Reference origin for tile host * Delete prisma/views/public/vw_map_fields.sql * Delete seed.sql * Cleanup ERD generation * Add migration to relate themes with scenarios * Support theme_scenario through table * Fixup app data model * Add ERD dependency * Re-activate scenario control * Update ERD * Slim down data * Simplify * Update README.md * Disable buggy ERD generation * Cleanup * Avoid creating theme_scenario for baseline scenario * Avoid global window error * Fix geo data * Apply suggestions from code review Co-authored-by: Tammo Feldmann <31222040+Tammo-Feldmann@users.noreply.github.com> * Cleanup SQL * Delete .github/workflows/lint.yaml --------- Co-authored-by: Emma Paz <emma@developmentseed.org> Co-authored-by: Tammo Feldmann <31222040+Tammo-Feldmann@users.noreply.github.com>
- Loading branch information
1 parent
d5d0291
commit f8a32ff
Showing
33 changed files
with
1,702 additions
and
186 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,5 +36,4 @@ yarn-error.log* | |
.turbo | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
data | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import prisma from "@/lib/prisma" | ||
import { Prisma } from "@prisma/client" | ||
|
||
export async function GET(req, { params }) { | ||
const { coordinates, study_slug } = params | ||
const lineStringCoords = Prisma.raw(decodeURI(coordinates)) | ||
|
||
const buildings = await prisma.$queryRaw` | ||
SELECT | ||
key | ||
FROM | ||
geometries | ||
WHERE | ||
ST_Intersects( | ||
ST_Transform(geom, 3857), | ||
ST_Transform( | ||
ST_Polygon( | ||
'LINESTRING(${lineStringCoords})'::geometry, | ||
4326 | ||
), | ||
3857 | ||
) | ||
) | ||
AND | ||
study_slug = ${study_slug} | ||
` | ||
|
||
return Response.json({ buildings }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import { cache } from "react" | ||
import prisma from "@/lib/prisma" | ||
import { study } from "@prisma/client" | ||
|
||
export const getStudies: () => Promise<study[]> = cache(prisma.study.findMany) | ||
|
||
export const getStudies = cache(prisma.study.findMany) | ||
export const getStudy = cache((slug: string) => | ||
prisma.study.findUnique({ | ||
where: { slug }, | ||
include: { themes: { include: { scenarios: true } } }, | ||
include: { | ||
themes: { | ||
include: { scenarios: { include: { scenario: true } } }, | ||
}, | ||
}, | ||
}) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.