-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from GSA-TTS/architecture
Architecture diagram for discussion
- Loading branch information
Showing
16 changed files
with
340 additions
and
55 deletions.
There are no files selected for viewing
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,3 +1,7 @@ | ||
import { createAppRoot } from './views/main'; | ||
|
||
createAppRoot(document.getElementById('root') as HTMLElement, {}); | ||
createAppRoot(document.getElementById('root') as HTMLElement, { | ||
backend: { | ||
helloWorld: (str: string) => str, | ||
}, | ||
}); |
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,25 @@ | ||
version: '3' | ||
|
||
services: | ||
web: | ||
image: jhpyle/docassemble | ||
ports: | ||
- '8011:80' | ||
volumes: | ||
- data:/usr/share/docassemble/data | ||
- log:/usr/share/docassemble/log | ||
- config:/usr/share/docassemble/config | ||
- webapp:/usr/share/docassemble/webapp | ||
redis: | ||
image: 'redis:latest' | ||
postgres: | ||
image: 'postgres:latest' | ||
environment: | ||
POSTGRES_DB: docassemble | ||
POSTGRES_USER: docassemble | ||
POSTGRES_PASSWORD: secret-password | ||
volumes: | ||
data: | ||
log: | ||
config: | ||
webapp: |
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 @@ | ||
.env |
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,11 @@ | ||
# @atj/docassemble | ||
|
||
This package is the home for adapters that leverage [docassemble](https://docassemble.org/). | ||
|
||
## Development | ||
|
||
Run tests with coverage: | ||
|
||
```bash | ||
pnpm test | ||
``` |
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,18 @@ | ||
{ | ||
"name": "@atj/docassemble", | ||
"version": "1.0.0", | ||
"description": "10x ATJ docassemble adapter", | ||
"license": "CC0", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "tsup src/* --env.NODE_ENV production", | ||
"test": "vitest run --coverage" | ||
}, | ||
"dependencies": { | ||
"@atj/documents": "workspace:*", | ||
"@atj/interviews": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"vitest": "^0.34.4" | ||
} | ||
} |
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,11 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { createTestDocassembleClient } from './context/test'; | ||
|
||
describe('docassemble api client', () => { | ||
const client = createTestDocassembleClient(); | ||
|
||
it('returns a list of interviews', async () => { | ||
const interviews = await client.getInterviews(); | ||
expect(interviews).not.toEqual(null); | ||
}); | ||
}); |
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,33 @@ | ||
import { DocassembleInterview } from './types'; | ||
|
||
export const createDocassembleInterview = (interviewId: string) => {}; | ||
|
||
export type DocassembleClientContext = { | ||
apiUrl: string; | ||
apiKey: string; | ||
}; | ||
|
||
export class DocassembleClient { | ||
constructor(private ctx: DocassembleClientContext) {} | ||
|
||
getInterviews = () => { | ||
return fetch(`${this.ctx.apiUrl}/api/interviews`, { | ||
headers: { | ||
'X-API-Key': this.ctx.apiKey, | ||
}, | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
return { | ||
ok: true, | ||
interviews: data.items as DocassembleInterview[], | ||
}; | ||
}) | ||
.catch(error => { | ||
return { | ||
ok: false, | ||
error: error.message, | ||
}; | ||
}); | ||
}; | ||
} |
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,5 @@ | ||
import { DocassembleClient, type DocassembleClientContext } from '../client'; | ||
|
||
export const createDocassembleClient = (ctx: DocassembleClientContext) => { | ||
return new DocassembleClient(ctx); | ||
}; |
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,8 @@ | ||
import { createDocassembleClient } from '.'; | ||
|
||
export const createTestDocassembleClient = () => { | ||
return createDocassembleClient({ | ||
apiUrl: 'http://localhost:8011', | ||
apiKey: (import.meta as any).env.VITE_DOCASSEMBLE_API_KEY || '', | ||
}); | ||
}; |
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,21 @@ | ||
// Guessing at the types here, based on the JSON returned by the API. | ||
export type DocassembleInterview = { | ||
email: string; | ||
filename: string; | ||
metadata: { | ||
_origin_package: string; | ||
_origin_path: string; | ||
title: string; | ||
}; | ||
modtime: string; | ||
session: string; | ||
starttime: string; | ||
subtitle: string | null; | ||
tags: string[]; | ||
temp_user_id: string | null; | ||
title: string; | ||
user_id: number; | ||
utc_modtime: string; | ||
utc_starttime: string | null; | ||
valid: boolean; | ||
}; |
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,11 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": [ | ||
"./src" | ||
], | ||
"references": [] | ||
} |
Oops, something went wrong.