diff --git a/TODO.md b/TODO.md index 6e3c13b..9dae747 100644 --- a/TODO.md +++ b/TODO.md @@ -3,7 +3,10 @@ push offers cover off admin routes and commands -decline / unaccept minimum quality listen / notify + on offers + notify admins + + diff --git a/api/index.ts b/api/index.ts index db3aa2b..9d0e921 100644 --- a/api/index.ts +++ b/api/index.ts @@ -29,6 +29,7 @@ async function start() { } = createServices(log); // events.emit(Events.StartupSync); + events.emit(Events.ListingsUpdated); api.listen(); } diff --git a/api/src/pg.ts b/api/src/pg.ts index 4cb4432..3dfc6fc 100644 --- a/api/src/pg.ts +++ b/api/src/pg.ts @@ -52,7 +52,10 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg { async function userOffers(user: User) { return prisma.offer.findMany({ - where: { userId: user.id }, + where: { + userId: user.id, + status: { not: Status.Declined } + }, include: { want: true, }, diff --git a/api/src/rpc.ts b/api/src/rpc.ts index 2d8e9ae..5726bd3 100644 --- a/api/src/rpc.ts +++ b/api/src/rpc.ts @@ -67,6 +67,11 @@ export default function createRpc(log: Log, pg: Pg, user: User, ws, discogs, off async function receive(message: any): Promise { const [msgType, params] = message; + if (!user) { + log.debug('anon rpc call'); + return [RpcMessageType.Pong, []]; + } + if (msgType !== RpcMessageType.Ping) log.info({ msgType, params }, 'rpc message'); // // this sucks but can't figure out how to convince typescript to agree yet diff --git a/client/src/components/offer.tsx b/client/src/components/offer.tsx index 2bffb65..9d02283 100644 --- a/client/src/components/offer.tsx +++ b/client/src/components/offer.tsx @@ -23,8 +23,8 @@ export default function Offer(offer) { : 'Accept'; const negBtn = accepted - ? 'Cancel' - : 'decline'; + ? + : ; return (
@@ -37,7 +37,7 @@ export default function Offer(offer) { - + {negBtn}
) } diff --git a/client/src/routes/acp.tsx b/client/src/routes/acp.tsx index 4a83fa1..dcb6765 100644 --- a/client/src/routes/acp.tsx +++ b/client/src/routes/acp.tsx @@ -31,8 +31,10 @@ function Item({ item }) {

{item.listing.data.release.description}

+
{item.user.email}
{item.total}
{item.status}
+ diff --git a/client/src/style/index.less b/client/src/style/index.less index 0f1b53e..59e92a2 100644 --- a/client/src/style/index.less +++ b/client/src/style/index.less @@ -300,22 +300,23 @@ header { flex-flow: row; .bundle { - display: grid; - grid-template-columns: 2fr 1fr; margin-bottom: var(--base-spacing-double); + section { + margin-bottom: var(--base-spacing); + } + .items { - grid-column: 1 / -1; + // grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); - align-items: stretch; div { margin-right: var(--base-spacing); margin-bottom: var(--base-spacing); display: grid; - grid-template-rows: 1fr 1fr 1fr; + // grid-template-rows: 1fr 1fr 1fr; } } }