All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 3m36s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m24s
The board Dropstar drew on 2026-10-23: Arte recebida, Arte conferida, Imprimindo, Correção, Revisão, Finalizado. - Fila de impressão leaves the board: Arte conferida is the queue. It takes an order only with every item's final approved, keeps the finals as approved, orders its cards for printing and has the room's "Baixar" and the automatic folder. Orders that were in the queue move there once, with a line in their history - Revisão checks the printed sheet, and the new Revisor profile is the only one that sends an order to Finalizado (the superadmin too, for support) - who moves what, from the server (MOVES): the designer the artwork, asking for corrections and bringing the new art back; the operator Arte conferida to Imprimindo to Revisão; admin and gestão everything else, Correção included; a step back belongs to whoever makes the move it undoes - Tiny: Arte conferida is "Preparando envio" and Finalizado "Pronto para envio", for delivery orders too - Prova OK still comes before Finalizado; the customer's portal shows the new steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 lines
4.2 KiB
Python
83 lines
4.2 KiB
Python
"""A demo customer for looking around Minha conta on the local stack.
|
|
|
|
docker compose -f compose.local.yaml exec -T -e SITE_BASE_URL=http://site \
|
|
-e SITE_HOST_HEADER=localhost api python -m ops.demo_customer
|
|
|
|
Creates, once, an account with twelve paid orders in different stages, one in
|
|
correction and a cart waiting for PIX. Sign in at http://localhost:8080/conta
|
|
with DEMO_EMAIL and DEMO_PASSWORD below. Local test values only: the script
|
|
refuses to run anywhere but the local stack.
|
|
"""
|
|
import os
|
|
import sys
|
|
from uuid import uuid4
|
|
|
|
DEMO_EMAIL = 'demo@dropstar.test'
|
|
DEMO_PASSWORD = 'demo-dropstar-local'
|
|
DEMO_CNPJ = '11222333000181'
|
|
|
|
|
|
def main():
|
|
if os.environ.get('APP_ENV') != 'local':
|
|
sys.exit('Only on the local stack.')
|
|
from app.core import db
|
|
import tests.smoke_test as smoke
|
|
from tests.smoke_test import Client, approved_quote, item_spec, upload_bytes
|
|
# Upload links are signed for the address the browser uses (localhost:9000),
|
|
# which inside this container is the container itself: send them to the
|
|
# storage service, keeping the signed Host.
|
|
public = os.environ.get('S3_PUBLIC_ENDPOINT', '').rstrip('/')
|
|
if public and public != 'http://storage:9000':
|
|
plain = smoke.urlopen
|
|
def via_storage(request, *args, **kwargs):
|
|
if isinstance(request, smoke.Request) and request.full_url.startswith(public + '/'):
|
|
request.add_header('Host', public.split('//', 1)[1])
|
|
request.full_url = 'http://storage:9000' + request.full_url[len(public):]
|
|
return plain(request, *args, **kwargs)
|
|
smoke.urlopen = via_storage
|
|
with db.connect() as c:
|
|
if c.execute('SELECT 1 FROM dtf_local.accounts WHERE email=%s', (DEMO_EMAIL,)).fetchone():
|
|
print(f'Demo customer already exists: {DEMO_EMAIL}')
|
|
return
|
|
client = Client()
|
|
client.call('/session')
|
|
profile = {'cnpj': DEMO_CNPJ, 'zap': '16999990000', 'mail': DEMO_EMAIL}
|
|
orders = []
|
|
for i in range(12):
|
|
uid = upload_bytes(client, b'DEMO ARTWORK %d' % i)
|
|
item = item_spec('file', f'{1 + i * 0.3:.1f}', 0, uid)
|
|
quote = client.call('/quotes', {'request_key': str(uuid4()), 'customer': profile, 'items': [item],
|
|
'freight': {'service': 'pickup'}})
|
|
approved_quote(client, quote, [item])
|
|
orders.append(client.call('/orders/dev-paid', {'quote_id': quote['id']}))
|
|
# Spread them over the production stages, one waiting for a correction.
|
|
stages = {0: ['tra', 'imp', 'rev', 'fin'], 1: ['tra', 'imp', 'rev', 'fin'], 2: ['tra', 'imp', 'rev'],
|
|
3: ['tra', 'imp'], 4: ['tra'], 5: ['cor']}
|
|
for index, path in stages.items():
|
|
order = orders[index]
|
|
version = order['version']
|
|
for state in path:
|
|
if state == 'tra':
|
|
# Arte conferida, the print queue, takes approved final files, as on the Kanban.
|
|
final = upload_bytes(client, b'DEMO FINAL %d' % index, order_id=order['id'])
|
|
version = client.call('/operator/orders/' + order['id'] + '/final-files',
|
|
{'version': version, 'files': [{'item_index': 0, 'upload_id': final}],
|
|
'note': 'Arquivo final da demonstração'}, operator=True)['version']
|
|
body = {'state': state, 'version': version}
|
|
if state == 'cor':
|
|
body['reason'] = 'A arte está com fundo branco; envie em PNG com fundo transparente.'
|
|
version = client.call('/operator/orders/' + order['id'] + '/move', body, operator=True)['version']
|
|
# The cart waiting for payment, with a PIX code open.
|
|
uid = upload_bytes(client, b'DEMO ARTWORK UNPAID')
|
|
item = item_spec('file', '2.3', 0, uid)
|
|
quote = client.call('/quotes', {'request_key': str(uuid4()), 'customer': profile, 'items': [item],
|
|
'freight': {'service': 'pickup'}})
|
|
approved_quote(client, quote, [item])
|
|
client.call('/payments/intent', {'quote_id': quote['id'], 'method': {'type': 'pix'}})
|
|
smoke.register(client, profile, DEMO_PASSWORD)
|
|
print(f'Demo customer created: {DEMO_EMAIL}')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|