mirror of
https://github.com/documenso/documenso.git
synced 2025-11-22 04:31:39 +10:00
Compare commits
1 Commits
feat/get-d
...
chore/tran
| Author | SHA1 | Date | |
|---|---|---|---|
| a72f7f305f |
@ -8,7 +8,7 @@ msgstr ""
|
|||||||
"Language: pl\n"
|
"Language: pl\n"
|
||||||
"Project-Id-Version: documenso-app\n"
|
"Project-Id-Version: documenso-app\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2025-11-20 02:32\n"
|
"PO-Revision-Date: 2025-11-21 00:14\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: Polish\n"
|
"Language-Team: Polish\n"
|
||||||
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
|
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
|
||||||
@ -7584,7 +7584,7 @@ msgstr "Liczba podpisów"
|
|||||||
#: packages/ui/components/document/envelope-recipient-field-tooltip.tsx
|
#: packages/ui/components/document/envelope-recipient-field-tooltip.tsx
|
||||||
#: packages/ui/components/document/document-read-only-fields.tsx
|
#: packages/ui/components/document/document-read-only-fields.tsx
|
||||||
msgid "Signed"
|
msgid "Signed"
|
||||||
msgstr "Podpisał"
|
msgstr "Podpisano"
|
||||||
|
|
||||||
#: apps/remix/app/components/dialogs/envelope-download-dialog.tsx
|
#: apps/remix/app/components/dialogs/envelope-download-dialog.tsx
|
||||||
msgctxt "Signed document (adjective)"
|
msgctxt "Signed document (adjective)"
|
||||||
|
|||||||
@ -1,74 +0,0 @@
|
|||||||
import { EnvelopeType } from '@prisma/client';
|
|
||||||
|
|
||||||
import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';
|
|
||||||
import { mapEnvelopesToDocumentMany } from '@documenso/lib/utils/document';
|
|
||||||
import { mapDocumentIdToSecondaryId } from '@documenso/lib/utils/envelope';
|
|
||||||
import { prisma } from '@documenso/prisma';
|
|
||||||
|
|
||||||
import { authenticatedProcedure } from '../trpc';
|
|
||||||
import {
|
|
||||||
ZGetDocumentsByIdsRequestSchema,
|
|
||||||
ZGetDocumentsByIdsResponseSchema,
|
|
||||||
getDocumentsByIdsMeta,
|
|
||||||
} from './get-documents-by-ids.types';
|
|
||||||
|
|
||||||
export const getDocumentsByIdsRoute = authenticatedProcedure
|
|
||||||
.meta(getDocumentsByIdsMeta)
|
|
||||||
.input(ZGetDocumentsByIdsRequestSchema)
|
|
||||||
.output(ZGetDocumentsByIdsResponseSchema)
|
|
||||||
.mutation(async ({ input, ctx }) => {
|
|
||||||
const { teamId, user } = ctx;
|
|
||||||
const { documentIds } = input;
|
|
||||||
|
|
||||||
ctx.logger.info({
|
|
||||||
input: {
|
|
||||||
documentIds,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
|
||||||
id: {
|
|
||||||
type: 'documentId',
|
|
||||||
id: documentIds[0],
|
|
||||||
},
|
|
||||||
userId: user.id,
|
|
||||||
teamId,
|
|
||||||
type: EnvelopeType.DOCUMENT,
|
|
||||||
});
|
|
||||||
|
|
||||||
const envelopeOrInput = envelopeWhereInput.OR!;
|
|
||||||
|
|
||||||
const secondaryIds = documentIds.map((documentId) => mapDocumentIdToSecondaryId(documentId));
|
|
||||||
|
|
||||||
const envelopes = await prisma.envelope.findMany({
|
|
||||||
where: {
|
|
||||||
type: EnvelopeType.DOCUMENT,
|
|
||||||
secondaryId: {
|
|
||||||
in: secondaryIds,
|
|
||||||
},
|
|
||||||
OR: envelopeOrInput,
|
|
||||||
},
|
|
||||||
include: {
|
|
||||||
user: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
email: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
recipients: {
|
|
||||||
orderBy: {
|
|
||||||
id: 'asc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
team: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
url: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return envelopes.map((envelope) => mapEnvelopesToDocumentMany(envelope));
|
|
||||||
});
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import { ZDocumentManySchema } from '@documenso/lib/types/document';
|
|
||||||
|
|
||||||
import type { TrpcRouteMeta } from '../trpc';
|
|
||||||
|
|
||||||
export const getDocumentsByIdsMeta: TrpcRouteMeta = {
|
|
||||||
openapi: {
|
|
||||||
method: 'POST',
|
|
||||||
path: '/document/get-many',
|
|
||||||
summary: 'Get multiple documents',
|
|
||||||
description: 'Retrieve multiple documents by their IDs',
|
|
||||||
tags: ['Document'],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ZGetDocumentsByIdsRequestSchema = z.object({
|
|
||||||
documentIds: z.array(z.number()).min(1),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const ZGetDocumentsByIdsResponseSchema = z.array(ZDocumentManySchema);
|
|
||||||
|
|
||||||
export type TGetDocumentsByIdsRequest = z.infer<typeof ZGetDocumentsByIdsRequestSchema>;
|
|
||||||
export type TGetDocumentsByIdsResponse = z.infer<typeof ZGetDocumentsByIdsResponseSchema>;
|
|
||||||
@ -19,7 +19,6 @@ import { findDocumentsInternalRoute } from './find-documents-internal';
|
|||||||
import { findInboxRoute } from './find-inbox';
|
import { findInboxRoute } from './find-inbox';
|
||||||
import { getDocumentRoute } from './get-document';
|
import { getDocumentRoute } from './get-document';
|
||||||
import { getDocumentByTokenRoute } from './get-document-by-token';
|
import { getDocumentByTokenRoute } from './get-document-by-token';
|
||||||
import { getDocumentsByIdsRoute } from './get-documents-by-ids';
|
|
||||||
import { getInboxCountRoute } from './get-inbox-count';
|
import { getInboxCountRoute } from './get-inbox-count';
|
||||||
import { redistributeDocumentRoute } from './redistribute-document';
|
import { redistributeDocumentRoute } from './redistribute-document';
|
||||||
import { searchDocumentRoute } from './search-document';
|
import { searchDocumentRoute } from './search-document';
|
||||||
@ -28,7 +27,6 @@ import { updateDocumentRoute } from './update-document';
|
|||||||
|
|
||||||
export const documentRouter = router({
|
export const documentRouter = router({
|
||||||
get: getDocumentRoute,
|
get: getDocumentRoute,
|
||||||
getMany: getDocumentsByIdsRoute,
|
|
||||||
find: findDocumentsRoute,
|
find: findDocumentsRoute,
|
||||||
create: createDocumentRoute,
|
create: createDocumentRoute,
|
||||||
update: updateDocumentRoute,
|
update: updateDocumentRoute,
|
||||||
|
|||||||
@ -1,93 +0,0 @@
|
|||||||
import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';
|
|
||||||
import { prisma } from '@documenso/prisma';
|
|
||||||
|
|
||||||
import { authenticatedProcedure } from '../trpc';
|
|
||||||
import {
|
|
||||||
ZGetEnvelopesByIdsRequestSchema,
|
|
||||||
ZGetEnvelopesByIdsResponseSchema,
|
|
||||||
getEnvelopesByIdsMeta,
|
|
||||||
} from './get-envelopes-by-ids.types';
|
|
||||||
|
|
||||||
export const getEnvelopesByIdsRoute = authenticatedProcedure
|
|
||||||
.meta(getEnvelopesByIdsMeta)
|
|
||||||
.input(ZGetEnvelopesByIdsRequestSchema)
|
|
||||||
.output(ZGetEnvelopesByIdsResponseSchema)
|
|
||||||
.mutation(async ({ input, ctx }) => {
|
|
||||||
const { teamId, user } = ctx;
|
|
||||||
const { envelopeIds } = input;
|
|
||||||
|
|
||||||
ctx.logger.info({
|
|
||||||
input: {
|
|
||||||
envelopeIds,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
|
||||||
id: {
|
|
||||||
type: 'envelopeId',
|
|
||||||
id: envelopeIds[0],
|
|
||||||
},
|
|
||||||
userId: user.id,
|
|
||||||
teamId,
|
|
||||||
type: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
const envelopeOrInput = envelopeWhereInput.OR!;
|
|
||||||
|
|
||||||
const envelopes = await prisma.envelope.findMany({
|
|
||||||
where: {
|
|
||||||
id: {
|
|
||||||
in: envelopeIds,
|
|
||||||
},
|
|
||||||
OR: envelopeOrInput,
|
|
||||||
},
|
|
||||||
include: {
|
|
||||||
envelopeItems: {
|
|
||||||
include: {
|
|
||||||
documentData: true,
|
|
||||||
},
|
|
||||||
orderBy: {
|
|
||||||
order: 'asc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
folder: true,
|
|
||||||
documentMeta: true,
|
|
||||||
user: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
email: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
recipients: {
|
|
||||||
orderBy: {
|
|
||||||
id: 'asc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fields: true,
|
|
||||||
team: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
url: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
directLink: {
|
|
||||||
select: {
|
|
||||||
directTemplateRecipientId: true,
|
|
||||||
enabled: true,
|
|
||||||
id: true,
|
|
||||||
token: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return envelopes.map((envelope) => ({
|
|
||||||
...envelope,
|
|
||||||
user: {
|
|
||||||
id: envelope.user.id,
|
|
||||||
name: envelope.user.name || '',
|
|
||||||
email: envelope.user.email,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import { ZEnvelopeSchema } from '@documenso/lib/types/envelope';
|
|
||||||
|
|
||||||
import type { TrpcRouteMeta } from '../trpc';
|
|
||||||
|
|
||||||
export const getEnvelopesByIdsMeta: TrpcRouteMeta = {
|
|
||||||
openapi: {
|
|
||||||
method: 'POST',
|
|
||||||
path: '/envelope/get-many',
|
|
||||||
summary: 'Get multiple envelopes',
|
|
||||||
description: 'Retrieve multiple envelopes by their IDs',
|
|
||||||
tags: ['Envelope'],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ZGetEnvelopesByIdsRequestSchema = z.object({
|
|
||||||
envelopeIds: z.array(z.string()).min(1),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const ZGetEnvelopesByIdsResponseSchema = z.array(ZEnvelopeSchema);
|
|
||||||
|
|
||||||
export type TGetEnvelopesByIdsRequest = z.infer<typeof ZGetEnvelopesByIdsRequestSchema>;
|
|
||||||
export type TGetEnvelopesByIdsResponse = z.infer<typeof ZGetEnvelopesByIdsResponseSchema>;
|
|
||||||
@ -21,7 +21,6 @@ import { updateEnvelopeRecipientsRoute } from './envelope-recipients/update-enve
|
|||||||
import { getEnvelopeRoute } from './get-envelope';
|
import { getEnvelopeRoute } from './get-envelope';
|
||||||
import { getEnvelopeItemsRoute } from './get-envelope-items';
|
import { getEnvelopeItemsRoute } from './get-envelope-items';
|
||||||
import { getEnvelopeItemsByTokenRoute } from './get-envelope-items-by-token';
|
import { getEnvelopeItemsByTokenRoute } from './get-envelope-items-by-token';
|
||||||
import { getEnvelopesByIdsRoute } from './get-envelopes-by-ids';
|
|
||||||
import { redistributeEnvelopeRoute } from './redistribute-envelope';
|
import { redistributeEnvelopeRoute } from './redistribute-envelope';
|
||||||
import { setEnvelopeFieldsRoute } from './set-envelope-fields';
|
import { setEnvelopeFieldsRoute } from './set-envelope-fields';
|
||||||
import { setEnvelopeRecipientsRoute } from './set-envelope-recipients';
|
import { setEnvelopeRecipientsRoute } from './set-envelope-recipients';
|
||||||
@ -67,7 +66,6 @@ export const envelopeRouter = router({
|
|||||||
sign: signEnvelopeFieldRoute,
|
sign: signEnvelopeFieldRoute,
|
||||||
},
|
},
|
||||||
get: getEnvelopeRoute,
|
get: getEnvelopeRoute,
|
||||||
getMany: getEnvelopesByIdsRoute,
|
|
||||||
create: createEnvelopeRoute,
|
create: createEnvelopeRoute,
|
||||||
use: useEnvelopeRoute,
|
use: useEnvelopeRoute,
|
||||||
update: updateEnvelopeRoute,
|
update: updateEnvelopeRoute,
|
||||||
|
|||||||
@ -1,127 +0,0 @@
|
|||||||
import { EnvelopeType } from '@prisma/client';
|
|
||||||
|
|
||||||
import { getEnvelopeWhereInput } from '@documenso/lib/server-only/envelope/get-envelope-by-id';
|
|
||||||
import {
|
|
||||||
mapSecondaryIdToTemplateId,
|
|
||||||
mapTemplateIdToSecondaryId,
|
|
||||||
} from '@documenso/lib/utils/envelope';
|
|
||||||
import { mapFieldToLegacyField } from '@documenso/lib/utils/fields';
|
|
||||||
import { mapRecipientToLegacyRecipient } from '@documenso/lib/utils/recipients';
|
|
||||||
import { prisma } from '@documenso/prisma';
|
|
||||||
|
|
||||||
import { authenticatedProcedure } from '../trpc';
|
|
||||||
import {
|
|
||||||
ZGetTemplatesByIdsRequestSchema,
|
|
||||||
ZGetTemplatesByIdsResponseSchema,
|
|
||||||
getTemplatesByIdsMeta,
|
|
||||||
} from './get-templates-by-ids.types';
|
|
||||||
|
|
||||||
export const getTemplatesByIdsRoute = authenticatedProcedure
|
|
||||||
.meta(getTemplatesByIdsMeta)
|
|
||||||
.input(ZGetTemplatesByIdsRequestSchema)
|
|
||||||
.output(ZGetTemplatesByIdsResponseSchema)
|
|
||||||
.mutation(async ({ input, ctx }) => {
|
|
||||||
const { teamId, user } = ctx;
|
|
||||||
const { templateIds } = input;
|
|
||||||
|
|
||||||
ctx.logger.info({
|
|
||||||
input: {
|
|
||||||
templateIds,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { envelopeWhereInput } = await getEnvelopeWhereInput({
|
|
||||||
id: {
|
|
||||||
type: 'templateId',
|
|
||||||
id: templateIds[0],
|
|
||||||
},
|
|
||||||
userId: user.id,
|
|
||||||
teamId,
|
|
||||||
type: EnvelopeType.TEMPLATE,
|
|
||||||
});
|
|
||||||
|
|
||||||
const envelopeOrInput = envelopeWhereInput.OR!;
|
|
||||||
|
|
||||||
const secondaryIds = templateIds.map((templateId) => mapTemplateIdToSecondaryId(templateId));
|
|
||||||
|
|
||||||
const envelopes = await prisma.envelope.findMany({
|
|
||||||
where: {
|
|
||||||
type: EnvelopeType.TEMPLATE,
|
|
||||||
secondaryId: {
|
|
||||||
in: secondaryIds,
|
|
||||||
},
|
|
||||||
OR: envelopeOrInput,
|
|
||||||
},
|
|
||||||
include: {
|
|
||||||
recipients: {
|
|
||||||
orderBy: {
|
|
||||||
id: 'asc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fields: true,
|
|
||||||
team: {
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
url: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
documentMeta: {
|
|
||||||
select: {
|
|
||||||
signingOrder: true,
|
|
||||||
distributionMethod: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
directLink: {
|
|
||||||
select: {
|
|
||||||
token: true,
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return envelopes.map((envelope) => {
|
|
||||||
const legacyTemplateId = mapSecondaryIdToTemplateId(envelope.secondaryId);
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: legacyTemplateId,
|
|
||||||
envelopeId: envelope.id,
|
|
||||||
type: envelope.templateType,
|
|
||||||
visibility: envelope.visibility,
|
|
||||||
externalId: envelope.externalId,
|
|
||||||
title: envelope.title,
|
|
||||||
userId: envelope.userId,
|
|
||||||
teamId: envelope.teamId,
|
|
||||||
authOptions: envelope.authOptions,
|
|
||||||
createdAt: envelope.createdAt,
|
|
||||||
updatedAt: envelope.updatedAt,
|
|
||||||
publicTitle: envelope.publicTitle,
|
|
||||||
publicDescription: envelope.publicDescription,
|
|
||||||
folderId: envelope.folderId,
|
|
||||||
useLegacyFieldInsertion: envelope.useLegacyFieldInsertion,
|
|
||||||
team: envelope.team
|
|
||||||
? {
|
|
||||||
id: envelope.team.id,
|
|
||||||
url: envelope.team.url,
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
fields: envelope.fields.map((field) => mapFieldToLegacyField(field, envelope)),
|
|
||||||
recipients: envelope.recipients.map((recipient) =>
|
|
||||||
mapRecipientToLegacyRecipient(recipient, envelope),
|
|
||||||
),
|
|
||||||
templateMeta: envelope.documentMeta
|
|
||||||
? {
|
|
||||||
signingOrder: envelope.documentMeta.signingOrder,
|
|
||||||
distributionMethod: envelope.documentMeta.distributionMethod,
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
directLink: envelope.directLink
|
|
||||||
? {
|
|
||||||
token: envelope.directLink.token,
|
|
||||||
enabled: envelope.directLink.enabled,
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
templateDocumentDataId: '', // Backwards compatibility.
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import { ZTemplateManySchema } from '@documenso/lib/types/template';
|
|
||||||
|
|
||||||
import type { TrpcRouteMeta } from '../trpc';
|
|
||||||
|
|
||||||
export const getTemplatesByIdsMeta: TrpcRouteMeta = {
|
|
||||||
openapi: {
|
|
||||||
method: 'POST',
|
|
||||||
path: '/template/get-many',
|
|
||||||
summary: 'Get multiple templates',
|
|
||||||
description: 'Retrieve multiple templates by their IDs',
|
|
||||||
tags: ['Template'],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ZGetTemplatesByIdsRequestSchema = z.object({
|
|
||||||
templateIds: z.array(z.number()).min(1),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const ZGetTemplatesByIdsResponseSchema = z.array(ZTemplateManySchema);
|
|
||||||
|
|
||||||
export type TGetTemplatesByIdsRequest = z.infer<typeof ZGetTemplatesByIdsRequestSchema>;
|
|
||||||
export type TGetTemplatesByIdsResponse = z.infer<typeof ZGetTemplatesByIdsResponseSchema>;
|
|
||||||
@ -30,7 +30,6 @@ import { mapEnvelopeToTemplateLite } from '@documenso/lib/utils/templates';
|
|||||||
|
|
||||||
import { ZGenericSuccessResponse, ZSuccessResponseSchema } from '../schema';
|
import { ZGenericSuccessResponse, ZSuccessResponseSchema } from '../schema';
|
||||||
import { authenticatedProcedure, maybeAuthenticatedProcedure, router } from '../trpc';
|
import { authenticatedProcedure, maybeAuthenticatedProcedure, router } from '../trpc';
|
||||||
import { getTemplatesByIdsRoute } from './get-templates-by-ids';
|
|
||||||
import {
|
import {
|
||||||
ZBulkSendTemplateMutationSchema,
|
ZBulkSendTemplateMutationSchema,
|
||||||
ZCreateDocumentFromDirectTemplateRequestSchema,
|
ZCreateDocumentFromDirectTemplateRequestSchema,
|
||||||
@ -155,11 +154,6 @@ export const templateRouter = router({
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
getMany: getTemplatesByIdsRoute,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until RR7 so we can passthrough documents.
|
* Wait until RR7 so we can passthrough documents.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user