Skip to content

Commit

Permalink
Fix issues with document endpoints being too restrictive (#21)
Browse files Browse the repository at this point in the history
* Fix issues with document endpoints being too restrictive

* remove set -x from script
  • Loading branch information
diversemix authored Oct 16, 2023
1 parent e447159 commit 79382dc
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 9 deletions.
14 changes: 7 additions & 7 deletions app/model/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ class DocumentReadDTO(BaseModel):
# From FamilyDocument
import_id: str
family_import_id: str
variant_name: str
variant_name: Optional[str]
status: DocumentStatus
role: str
type: str
role: Optional[str]
type: Optional[str]
slug: str
# From PhysicalDocument
physical_id: int
title: str
md5_sum: str
cdn_object: str
source_url: str
content_type: str
md5_sum: Optional[str]
cdn_object: Optional[str]
source_url: Optional[str]
content_type: Optional[str]
user_language_name: str
# TODO: Languages for a document
# languages: list[]
Expand Down
44 changes: 44 additions & 0 deletions integration_tests/blank.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,50 @@ REVOKE USAGE ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- Name: entity_counter; Type: TABLE; Schema: public; Owner: navigator
--

CREATE TABLE public.entity_counter (
id integer NOT NULL,
description character varying NOT NULL,
prefix character varying NOT NULL,
counter integer,
CONSTRAINT ck_entity_counter__prefix_allowed_orgs CHECK (((prefix)::text = ANY ((ARRAY['CCLW'::character varying, 'UNFCCC'::character varying])::text[])))
);


ALTER TABLE public.entity_counter OWNER TO navigator;

--
-- Name: entity_counter_id_seq; Type: SEQUENCE; Schema: public; Owner: navigator
--

CREATE SEQUENCE public.entity_counter_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


ALTER TABLE public.entity_counter_id_seq OWNER TO navigator;

--
-- Name: entity_counter_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: navigator
--

ALTER SEQUENCE public.entity_counter_id_seq OWNED BY public.entity_counter.id;


--
-- Name: entity_counter id; Type: DEFAULT; Schema: public; Owner: navigator
--

ALTER TABLE ONLY public.entity_counter ALTER COLUMN id SET DEFAULT nextval('public.entity_counter_id_seq'::regclass);


--
-- PostgreSQL database dump complete
--
Expand Down
7 changes: 5 additions & 2 deletions scripts/testing/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#
# It is your responsibility to set the SUPERUER_xxx vars.
#
export TEST_URL=https://m2bv8pdzts.eu-west-1.awsapprunner.com
#export TEST_URL=http://localhost:8888

export TEST_URL=http://localhost:8888

# This file should default to lcoalhost but here is the staging endpoint:
#export TEST_URL=https://m2bv8pdzts.eu-west-1.awsapprunner.com

get_token() {
curl -s \
Expand Down
8 changes: 8 additions & 0 deletions scripts/testing/get-all-documents
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
#
#
source config
TOKEN=$(get_token)
curl -s \
-H "Authorization: Bearer ${TOKEN}" \
${TEST_URL}/api/v1/documents
File renamed without changes.

0 comments on commit 79382dc

Please sign in to comment.