FastAPI backend (Python 3.11, MSSQL ODBC for SambaPOS, Azure DI OCR),
kitchen_db on central PG. React/TS/Vite frontend with navy sidebar layout.
Backend: auth.py (APP_SLUG=kitchen, SimpleNamespace — archive routes use
.kitchen_id/.is_admin without modification), main.py (51 migrations, scheduler,
internal router for KDS bookings feed), api/internal.py, full archive API
(31 routers: invoices, recipes, menus, sambapos, resos, newbook, disputes,
purchase_orders, etc.), models, migrations, OCR pipeline.
kitchen_id pinned to 1 (B1 — single hotel).
Frontend: AuthGate (app=kitchen, token shim for archive compat — B5b pending),
Layout (navy sidebar, 6 sections, Lucide icons, teal --app-primary),
App.tsx (Outlet pattern, UploadApp outside Layout), index.css (full :root block).
strict: false — archive components have type issues; build clean.
Note: 45 archive components call fetch('/api/...') without /kitchen/ prefix
(B5b). Runtime 404s; deferred until after initial testing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
69 lines
1.8 KiB
JavaScript
69 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
import utils from '../utils.js';
|
|
import AxiosURLSearchParams from './AxiosURLSearchParams.js';
|
|
|
|
/**
|
|
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
*
|
|
* @param {string} val The value to be encoded.
|
|
*
|
|
* @returns {string} The encoded value.
|
|
*/
|
|
export function encode(val) {
|
|
return encodeURIComponent(val)
|
|
.replace(/%3A/gi, ':')
|
|
.replace(/%24/g, '$')
|
|
.replace(/%2C/gi, ',')
|
|
.replace(/%20/g, '+');
|
|
}
|
|
|
|
/**
|
|
* Build a URL by appending params to the end
|
|
*
|
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
* @param {object} [params] The params to be appended
|
|
* @param {?(object|Function)} options
|
|
*
|
|
* @returns {string} The formatted url
|
|
*/
|
|
export default function buildURL(url, params, options) {
|
|
if (!params) {
|
|
return url;
|
|
}
|
|
url = url || '';
|
|
|
|
const _options = utils.isFunction(options)
|
|
? {
|
|
serialize: options,
|
|
}
|
|
: options;
|
|
|
|
// Read serializer options pollution-safely: own properties and methods on a
|
|
// class/template prototype are honored, but values injected onto a polluted
|
|
// Object.prototype are ignored.
|
|
const _encode = utils.getSafeProp(_options, 'encode') || encode;
|
|
const serializeFn = utils.getSafeProp(_options, 'serialize');
|
|
|
|
let serializedParams;
|
|
|
|
if (serializeFn) {
|
|
serializedParams = serializeFn(params, _options);
|
|
} else {
|
|
serializedParams = utils.isURLSearchParams(params)
|
|
? params.toString()
|
|
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
}
|
|
|
|
if (serializedParams) {
|
|
const hashmarkIndex = url.indexOf('#');
|
|
|
|
if (hashmarkIndex !== -1) {
|
|
url = url.slice(0, hashmarkIndex);
|
|
}
|
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
}
|
|
|
|
return url;
|
|
}
|