accounting_automation: Gmail читается от имени agents@ (участник группы invoice@), поиск по письмам на группу
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,7 @@ const app = buildApi({
|
|||||||
const mail = new GmailClient({
|
const mail = new GmailClient({
|
||||||
auth,
|
auth,
|
||||||
user: s.google.gmailUser,
|
user: s.google.gmailUser,
|
||||||
|
query: s.google.gmailQuery,
|
||||||
processedIds: async (ids) => {
|
processedIds: async (ids) => {
|
||||||
const { rows } = await pool.query("select message_id from acc_mail_processed where message_id = any($1) and result <> 'error'", [ids]);
|
const { rows } = await pool.query("select message_id from acc_mail_processed where message_id = any($1) and result <> 'error'", [ids]);
|
||||||
return new Set(rows.map((r) => r.message_id as string));
|
return new Set(rows.map((r) => r.message_id as string));
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ export const accountingSchema = z.object({
|
|||||||
.object({
|
.object({
|
||||||
client_email: z.string(),
|
client_email: z.string(),
|
||||||
private_key: z.string(),
|
private_key: z.string(),
|
||||||
/** Ящик, который читаем (делегирование домена). */
|
/** Ящик пользователя, который читаем (делегирование домена; группа invoice@ доставляет письма в ящик участника agents@). */
|
||||||
gmailUser: z.string().default("invoices@khbuild.pro"),
|
gmailUser: z.string().default("agents@khbuild.pro"),
|
||||||
|
/** Поиск писем в ящике: только письма, пришедшие на группу invoice@ (или алиас invoices@), с PDF. */
|
||||||
|
gmailQuery: z.string().default("has:attachment filename:pdf (to:invoice@khbuild.pro OR cc:invoice@khbuild.pro OR to:invoices@khbuild.pro OR cc:invoices@khbuild.pro)"),
|
||||||
/** Корневая папка Google Drive для инвойсов, чеков и т.д. (подпапки создаются сервисом). */
|
/** Корневая папка Google Drive для инвойсов, чеков и т.д. (подпапки создаются сервисом). */
|
||||||
rootFolderId: z.string().optional(),
|
rootFolderId: z.string().optional(),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user