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

No ref/phase 3 endpoints #258

Open
wants to merge 21 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
8 changes: 8 additions & 0 deletions app/api/schema/collections/[uuid]/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NextResponse } from "next/server";
import collectionsLandingPageSchema from "../../../../src/data/schemas/collectionsLandingPageSchema";

export const GET = async () => {
return NextResponse.json(collectionsLandingPageSchema, { status: 200 });
};

// http://localhost:3000/api/schema/collections/:uuid
8 changes: 8 additions & 0 deletions app/api/schema/collections/[uuid]/structure/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NextResponse } from "next/server";
import collectionsStructureSchema from "../../../../../src/data/schemas/collectionsStructureSchema";

export const GET = async () => {
return NextResponse.json(collectionsStructureSchema, { status: 200 });
};

// http://localhost:3000/api/schema/collections/:uuid/structure
8 changes: 8 additions & 0 deletions app/api/schema/collections/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NextResponse } from "next/server";
import collectionsSchema from "../../../src/data/schemas/collectionsSchema";

export const GET = async () => {
return NextResponse.json(collectionsSchema, { status: 200 });
};

// http://localhost:3000/api/schema/collections/:uuid
8 changes: 8 additions & 0 deletions app/api/schema/search/facets/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NextResponse } from "next/server";
import searchFacetsSchema from "../../../../src/data/schemas/searchFacetsSchema";

export const GET = async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the intended api to use for the modal.

idk if facets is the right term to use here? filters is kind of more implicit of what is actually being searched.

regardless, interacting with the api to get the list of the filters in the modal would require a keyword search ie. q= and a way to identify the category we are searching, ie. category=.

return NextResponse.json(searchFacetsSchema, { status: 200 });
};

// http://localhost:3000/api/schema/search/facets
8 changes: 8 additions & 0 deletions app/api/schema/search/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { NextResponse } from "next/server";
import searchSchema from "../../../src/data/schemas/searchSchema";

export const GET = async () => {
return NextResponse.json(searchSchema, { status: 200 });
};

// http://localhost:3000/api/schema/search
14 changes: 14 additions & 0 deletions app/src/data/schemas/collectionSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const collectionObject = {
Copy link
Member

Choose a reason for hiding this comment

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

Where is this being used? Or is it for reference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just for reference

uuid: "string",
recordType: "collection | sub-collection",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
numberOfDigitizedItems: "number",
containsOnSiteMaterials: "boolean",
highlights: "{ highlighted_field_name:[ string ] }",
firstIndexed_dt: "date",
};

export default collectionObject;
41 changes: 41 additions & 0 deletions app/src/data/schemas/collectionsLandingPageSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const collectionsLandingPageSchema = {
response: {
numResults: "6",
page: "1",
perPage: "40",
Comment on lines +3 to +5
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, use "string" instead of specific values.

Copy link
Collaborator

Choose a reason for hiding this comment

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

^^

Copy link
Collaborator

Choose a reason for hiding this comment

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

But page/perPage should either always be a number or a string across all of these

items: [
{
uuid: "string",
recordType: "item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
contentType: "image | multiple images | audio | video | pdf",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way for this to express that these are the 5 strings we're interested in, but that we expect (I think) that there are actually more content types returned on the item. So we just want a string here, then on the model we would transform it as needed?

onSiteOnly: "boolean",
Copy link
Collaborator

Choose a reason for hiding this comment

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

would an item have an 'isAVMaterial' field

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or would that be covered by contentType

},
{
uuid: "string",
recordType: "item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
contentType: "image | multiple images | audio | video | pdf",
onSiteOnly: "boolean",
},
{
uuid: "string",
recordType: "item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
contentType: "image | multiple images | audio | video | pdf",
onSiteOnly: "boolean",
},
],
},
};

export default collectionsLandingPageSchema;
48 changes: 48 additions & 0 deletions app/src/data/schemas/collectionsSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const collectionsSchema = {
response: {
numResults: "6",
page: "1",
perPage: "40",
// move from "collection" to "collections"
collections: [
{
title: "string",
uuid: "string",
url: "string",
imageID: "string",
numberOfDigitizedItems: "string", // remove numItems
containsAVMaterial: "boolean",
constainsOnSiteMaterials: "boolean",
Comment on lines +14 to +15
Copy link
Member

Choose a reason for hiding this comment

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

These will always be either true or false right? So a null or empty value won't be the same as false?

},
{
title: "string",
uuid: "string",
url: "string",
imageID: "string",
numberOfDigitizedItems: "string",
containsAVMaterial: "boolean",
constainsOnSiteMaterials: "boolean",
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit but contains, not constains. Just in case this is what gets copy pasted into new api

},
{
title: "string",
uuid: "string",
url: "string",
imageID: "string",
numberOfDigitizedItems: "string",
containsAVMaterial: "boolean",
constainsOnSiteMaterials: "boolean",
},
{
title: "string",
uuid: "string",
url: "string",
imageID: "string",
numberOfDigitizedItems: "string",
containsAVMaterial: "boolean",
constainsOnSiteMaterials: "boolean",
},
],
},
};

export default collectionsSchema;
9 changes: 9 additions & 0 deletions app/src/data/schemas/collectionsStructureSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const collectionsStructureSchema = {
response: {
numResults: "6",
page: "1",
perPage: "40",
},
};

export default collectionsStructureSchema;
14 changes: 14 additions & 0 deletions app/src/data/schemas/itemObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const itemObject = {
Copy link
Member

Choose a reason for hiding this comment

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

This is also not being used yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think either of these will be "used" until they exist in new repo api but the idea was have an expected shape to base models off of

uuid: "string",
recordType: "item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
contentType: "image | multiple images | audio | video | pdf",
onSiteOnly: "boolean",
highlights: "{ highlighted_field_name:[ string ] }",
Copy link
Member

Choose a reason for hiding this comment

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

"highlights" is plural but the value is a single object. Is that right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm also a little confused by this one. Can you give an example of what this might return as

firstIndexed_dt: "date",
};

export default itemObject;
9 changes: 9 additions & 0 deletions app/src/data/schemas/searchFacetsSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const searchFacetsSchema = {
response: {
numResults: "6",
page: "1",
perPage: "40",
},
};

export default searchFacetsSchema;
64 changes: 64 additions & 0 deletions app/src/data/schemas/searchSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const searchSchema = {
response: {
// Keyword included in search
keyword: "string",
// Pagination fields
numResults: "integer",
page: "integer",
perPage: "integer",
Copy link
Collaborator

Choose a reason for hiding this comment

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

reiterating comment from collectionsSchema: page/perPage should either always be a number or a string across all of these

// Sort fields
sort: "string ie: title DESC",
// Filter fields
filterField: "string",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this an array of strings? Can you give an example of what this might return as

// Results
results: [
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

after reading the requirements for the modal in the brd, I think we can include the list of filter categories and the first 10 filters per category in this endpoint. each category would have a field for the total count of filters so the app knows when to display the "View all" button that loads the modal.

uuid: "string",
recordType: "collection | sub-collection | item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
numberOfDigitizedItems: "number",
containsOnSiteMaterials: "boolean | null if type is `item`",
contentType: "image | multiple images | audio | video | pdf | null",
onSiteOnly:
"boolean | null if type is `collection` or `sub-collection`",
Copy link
Member

Choose a reason for hiding this comment

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

We briefly talked about this but it might be easier to make it more typescript-y and give each object "collection", "sub-collection", and "item" a type. Then it's could be

results: [
  {
    uuid: ...
    recordType: "collection"
    ....
  },
  {
    uuid: ...
    recordType: "sub-collection"
    ....
  },
  {
    uuid: ...
    recordType: "item"
    ....
  }
]

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this idea. In general, this schema makes it really clear what the search results row card will have available to it

highlights: "{ highlighted_field_name:[ string ] }",
firstIndexed_dt: "date",
},
{
uuid: "string",
recordType: "collection | sub-collection | item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
numberOfDigitizedItems: "number",
containsOnSiteMaterials: "boolean | null if type is `item`",
contentType: "image | multiple images | audio | video | pdf | null",
onSiteOnly:
"boolean | null if type is `collection` or `sub-collection`",
highlights: "{ highlighted_field_name:[ string ] }",
firstIndexed_dt: "date",
},
{
uuid: "string",
recordType: "collection | sub-collection | item",
title: "string",
url: "string",
imageID: "string | null",
imageURL: "string",
numberOfDigitizedItems: "number",
containsOnSiteMaterials: "boolean | null if type is `item`",
contentType: "image | multiple images | audio | video | pdf | null",
onSiteOnly:
"boolean | null if type is `collection` or `sub-collection`",
highlights: "{ highlighted_field_name:[ string ] }",
firstIndexed_dt: "date",
},
],
},
};

export default searchSchema;
5 changes: 3 additions & 2 deletions public/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.2.6] 2025-1-09
## [0.2.6] 2025-1-13

### Updated

Expand All @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added "no results" view for the `/collections` page (DR-3324)
- Added "no results" view for the `/collections` page (DR-3324, DR-3357)

## [0.2.5] 2025-1-02

Expand All @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update timeout on API request to 10 seconds (DR-3304)
- Update header to expand on scroll up on desktop (DR-3322)
- Update google-site-verification meta tag (DR-3332)
- Updated `/collections` no results logic (DR-3357)

## [0.2.4] 2024-11-26

Expand Down
Loading