Git Product home page Git Product logo

stacks-service's Introduction

stacks-service

All the code in this repository has been moved to the items and requests projects in our catalogue-api repo.

stacks-service's People

Contributors

alexwlchan avatar jamesgorrie avatar kenoir avatar weco-bot avatar

Watchers

 avatar  avatar  avatar

stacks-service's Issues

Expose item status API behind consistent URL

We should have:

https://api.wellcomecollection.org/item-status
 |
 ↓
https://item-status.api.wellcomecollection.org/
 |
 ↓
https://api-gateway-id.execute-api.eu-west-1.amazonaws.com/stage

Questions from chat

Thoughts:

Add a note saying when a person wants something. Or neededBy.

Questions

What makes an item requestable?

  • It's not on the shelves

Can we not think about the cart?

What's average books person on request?

What would we want to surface on the client?

  • Physical items and distinguishing features e.g. how to access them
  • A status of the items requestability - is it already on hold?
  • Ability to create a hold - and where the item will be available (rare reading room / library desk)

Structure

/items returns

{
"status": "on Request",
//private
"requestedByMe": true
}

Catalogue API Locations should not be `Object`

Currently the Catalogue API presents locations as Object typed - which is inconvenient as they cannot then be used in the stacks service.

We need to:

  • Ensure a type discriminator is available for location types
  • Locations should have concrete types

Required for: #26

Document Sierra flow making holds

In order to understand if/how we are changing existing behaviour we should document existing behaviour in a markdown document in this repository.

Return right structure for status app

https://api.wellcomecollection.org/stacks/v1/status/works/:id needs to return

{
	"@context": "https://api.wellcomecollection.org/catalogue/v2/context.json",
	"type": "Work",
	"items": [{
		"id": "ys3ern6x",
		"identifiers": [{
				"identifierType": {
					"id": "sierra-system-number",
					"label": "Sierra system number",
					"type": "IdentifierType"
				},
				"value": "i16010176",
				"type": "Identifier"
			},
			{
				"identifierType": {
					"id": "sierra-identifier",
					"label": "Sierra identifier",
					"type": "IdentifierType"
				},
				"value": "1601017",
				"type": "Identifier"
			}
		],
		"locations": [{
				"locationType": {
					"id": "sicon",
					"label": "Closed stores Iconographic",
					"type": "LocationType"
				},
				"label": "Closed stores Iconographic",
				"type": "PhysicalLocation"
			},
			{
				"locationType": {
					"id": "iiif-presentation",
					"label": "IIIF Presentation API",
					"type": "LocationType"
				},
				"url": "https://wellcomelibrary.org/iiif/b16656180/manifest",
				"type": "DigitalLocation"
			},
			{
				"locationType": {
					"id": "iiif-image",
					"label": "IIIF Image API",
					"type": "LocationType"
				},
				"url": "https://iiif.wellcomecollection.org/image/L0053261.jpg/info.json",
				"credit": "Wellcome Collection",
				"license": {
					"id": "cc-by-nc",
					"label": "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)",
					"url": "https://creativecommons.org/licenses/by-nc/4.0/",
					"type": "License"
				},
				"type": "DigitalLocation"
			}
		],
		"type": "Item",
		"status": {
			"label": "Available",
			"id": "available"
		}
	}]
}

Request multiple items in a single request

We should allow a user to request multiple items at a time to allow timely and efficient responses to a client wanting the same.

What should this look like in our API?

Decide on how the request app will receive the patronID

Options

Request patronId from cognito on client

When authorising on the client to get the id_token used to authenticate against Cognito and API gateway, we request the patronId then.

This will then be encoded in the authorization header and the application will be able to decode it as a JWT.

  • client
  • login with patronID in scope
  • get id_token JWT with patronID encoded
  • send id_token as authorization header
  • decode patronID in app`

Deploy the items API without authentication

We don't need to put authentication in front of the items API (the information should be visible without logging in, at which point it's basically public).

We should deploy the items API without authentication, so that somebody can make requests and get responses.

This opens the door to the front-end starting to use this information.

Set up continuous integration

  • Add Github Actions to run tests on push to branches.
  • Ensure Github has the correct permissions to perform CI tasks (publish to ECR/retrieve from S3 libraries).
  • Add Github Actions to publish on merge to master.

Front-end acknowledges signed in user

In order to demonstrate reacting to a user authenticated status we should run an experiment in the front-end that notices if a user is signed in and provides console feedback if they are.

Another endpoint for request item status

Should we provide a mechanism to look up the status for an individual item for a particular user?

At present the client needs to request a users holds and then cross reference that with the items on a page - this causes both the API and the client to do unnecessary work.

I suggest filtering the GET /requests response with itemId, e.g.

GET /requests?itemId=abcdef

Authenticate users in the client

Users need to be authenticated with Cognito in the client:

  • Create cognito user pool in catalogue account for library users
  • Document intended authentication mechanism (authorization code grant with pkce): #28
  • Allow user to remain signed in (browser client stores access token state for session)
  • Handle refreshing client access token

Note: Are we comfortable storing the access token in the client? If we need to terminate a users access immediately how can we ensure their access tokens stop working? How can we invalidate a users access token if they are signed out?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.