Publish bills: Save meta, set bill ID, etc.#16
Conversation
| await writeFile(`./tmp/bill-${originalDocument.billId}.xml`, billXml); | ||
| console.log('Bill XML exported to', `./tmp/bill-${originalDocument.billId}.xml`); | ||
|
|
||
| await postBillForValidation(billXml); |
There was a problem hiding this comment.
I removed this as I'm not sure this is strictly needed. The same action is now performed when a bill is published. We can keep this if needed though. Just let me know.
|
|
||
| return xmlFormat(` | ||
| <bill> | ||
| <lagasafnID> |
There was a problem hiding this comment.
lagasafnID and related fields should be defined here, as the bill is being created in the lagasafn API.
|
|
||
| export const exportBillXml = (billTitle: string, billDocuments: BillDocument[]): string => { | ||
| const documents = billDocuments.map(document => parseDocument(document)); | ||
| export const exportBillMetaXml = (billPublicID: number, billTitle: string, billDescription: string): string => { |
There was a problem hiding this comment.
This exports bill meta XML, which is sent to lagasafn API when creating/updating a bill.
| title: string; | ||
| } | ||
|
|
||
| export const exportBillXml = (billTitle: string, billDocuments: BillDocument[]): string => { |
There was a problem hiding this comment.
Skip exporting billTitle - this is now done via the bill meta XML function.
| lagasafnID: number; | ||
| title: string; | ||
| description: string; | ||
| documents?: any; |
There was a problem hiding this comment.
lagasafnID refers to public bill ID, description describes the bill's purpose/aim. Both are consumed by the new lagasafn API bill meta XML endpoint.
| )} | ||
| {display === 'xml' && ( | ||
| <CodeBlock | ||
| text={exportBillXml(bill.title, documents)} |
| }; | ||
|
|
||
| export const postBillForPublishing = async (billXml: string) => { | ||
| export const postBillForPublishing = async (billNr: number, billXml: string) => { |
There was a problem hiding this comment.
The lagasafn API now expects bill number in the URL.
Add authorization headers for POST/PUT requests
No description provided.