Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
1.6 KiB
Plaintext
1 line
1.6 KiB
Plaintext
{"version":3,"sources":["../../../src/preferences/operations/findOne.ts"],"sourcesContent":["import type { TypedCollection } from '../../index.js'\nimport type { Where } from '../../types/index.js'\nimport type { PreferenceRequest } from '../types.js'\n\nimport { preferencesCollectionSlug } from '../config.js'\n\nexport async function findOne(args: PreferenceRequest): Promise<TypedCollection['_preference']> {\n const {\n key,\n req: { payload },\n req,\n user,\n } = args\n\n if (!user) {\n return null!\n }\n\n const where: Where = {\n and: [\n { key: { equals: key } },\n { 'user.value': { equals: user.id } },\n { 'user.relationTo': { equals: user.collection } },\n ],\n }\n\n const { docs } = await payload.db.find({\n collection: preferencesCollectionSlug,\n limit: 1,\n pagination: false,\n req,\n sort: '-updatedAt',\n where,\n })\n\n return docs?.[0] || null!\n}\n"],"names":["preferencesCollectionSlug","findOne","args","key","req","payload","user","where","and","equals","id","collection","docs","db","find","limit","pagination","sort"],"mappings":"AAIA,SAASA,yBAAyB,QAAQ,eAAc;AAExD,OAAO,eAAeC,QAAQC,IAAuB;IACnD,MAAM,EACJC,GAAG,EACHC,KAAK,EAAEC,OAAO,EAAE,EAChBD,GAAG,EACHE,IAAI,EACL,GAAGJ;IAEJ,IAAI,CAACI,MAAM;QACT,OAAO;IACT;IAEA,MAAMC,QAAe;QACnBC,KAAK;YACH;gBAAEL,KAAK;oBAAEM,QAAQN;gBAAI;YAAE;YACvB;gBAAE,cAAc;oBAAEM,QAAQH,KAAKI,EAAE;gBAAC;YAAE;YACpC;gBAAE,mBAAmB;oBAAED,QAAQH,KAAKK,UAAU;gBAAC;YAAE;SAClD;IACH;IAEA,MAAM,EAAEC,IAAI,EAAE,GAAG,MAAMP,QAAQQ,EAAE,CAACC,IAAI,CAAC;QACrCH,YAAYX;QACZe,OAAO;QACPC,YAAY;QACZZ;QACAa,MAAM;QACNV;IACF;IAEA,OAAOK,MAAM,CAAC,EAAE,IAAI;AACtB"} |