Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38b28752e1 | |||
| 87c51009de |
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.7.31](https://github.com/hagopj13/node-express-boilerplate/compare/coopback@1.7.31-alpha.1...coopback@1.7.31) (2024-08-25)
|
||||
|
||||
**Note:** Version bump only for package coopback
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.7.30](https://github.com/hagopj13/node-express-boilerplate/compare/coopback@1.7.29...coopback@1.7.30) (2024-08-13)
|
||||
|
||||
**Note:** Version bump only for package coopback
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "create-nodejs-express-app",
|
||||
"version": "1.7.31-alpha.1",
|
||||
"version": "1.7.31",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "create-nodejs-express-app",
|
||||
"version": "1.7.31-alpha.1",
|
||||
"version": "1.7.31",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@a2seven/yoo-checkout": "^1.1.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "coopback",
|
||||
"version": "1.7.31-alpha.1",
|
||||
"version": "1.7.31",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"bin": "bin/createNodejsApp.js",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.75](https://github.com/copenomics/coopdoc-generator-ts/compare/coopdoc-generator-ts@1.0.75-alpha.1...coopdoc-generator-ts@1.0.75) (2024-08-25)
|
||||
|
||||
**Note:** Version bump only for package coopdoc-generator-ts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.74](https://github.com/copenomics/coopdoc-generator-ts/compare/coopdoc-generator-ts@1.0.73...coopdoc-generator-ts@1.0.74) (2024-08-13)
|
||||
|
||||
**Note:** Version bump only for package coopdoc-generator-ts
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coopdoc-generator-ts",
|
||||
"type": "module",
|
||||
"version": "1.0.75-alpha.1",
|
||||
"version": "1.0.75",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.0.6",
|
||||
"description": "",
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * as JoinCoop from './registrator.joincoop'
|
||||
export * as JoinCoopDecision from './registrator.joincoopdec'
|
||||
export * as JoinProgram from './soviet.joinprog'
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import { DocFactory } from '../Factory'
|
||||
import type { IGeneratedDocument, IMetaDocument } from '../Interfaces'
|
||||
import type { MongoDBConnector } from '../Services/Databazor'
|
||||
import { DocumentsRegistry } from '../Templates'
|
||||
import type { IGenerateJoinProgram } from '../Interfaces/Actions'
|
||||
import type { IJoinProgram } from '../Templates/1000.ProgramProvision'
|
||||
|
||||
export class JoinProgramTemplateFactory extends DocFactory {
|
||||
constructor(storage: MongoDBConnector) {
|
||||
super(storage)
|
||||
}
|
||||
|
||||
async generateDocument(options: IGenerateJoinProgram): Promise<IGeneratedDocument> {
|
||||
// TODO
|
||||
/**
|
||||
* Получаем шаблон программы по registry_id из options (registry_id)
|
||||
* Получаем из бд парсера
|
||||
*/
|
||||
|
||||
let template
|
||||
|
||||
if (process.env.SOURCE === 'local') {
|
||||
template = DocumentsRegistry[options.registry_id as keyof typeof DocumentsRegistry]
|
||||
}
|
||||
else {
|
||||
template = await this.getTemplate(options.registry_id, options.block_num)
|
||||
}
|
||||
|
||||
const coop = await super.getCooperative(options.coopname, options.block_num)
|
||||
|
||||
const meta: IMetaDocument = await super.getMeta({
|
||||
title: template.title,
|
||||
...options,
|
||||
}) // Генерируем мета-данные
|
||||
|
||||
const combinedData: IJoinProgram = {
|
||||
meta,
|
||||
coop,
|
||||
protocol_number: options.protocol_number,
|
||||
protocol_day_month_year: options.protocol_day_month_year,
|
||||
}
|
||||
|
||||
// валидируем скомбинированные данные
|
||||
await super.validate(combinedData, template.model)
|
||||
|
||||
// получаем комплекс перевода
|
||||
const translation = template.translations[meta.lang]
|
||||
|
||||
// генерируем документ
|
||||
const document: IGeneratedDocument = await super.generatePDF(null, template.context, combinedData, translation, meta)
|
||||
|
||||
// сохраняем его в бд
|
||||
await super.saveDraft(document)
|
||||
|
||||
return document
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ export abstract class DocFactory {
|
||||
}
|
||||
|
||||
async generatePDF(
|
||||
data: externalDataTypes,
|
||||
data: externalDataTypes | null,
|
||||
context: string,
|
||||
vars: ICombinedData,
|
||||
translation: ITranslations,
|
||||
@@ -185,13 +185,14 @@ export abstract class DocFactory {
|
||||
return document
|
||||
}
|
||||
|
||||
getFullName(data: externalDataTypes): string {
|
||||
if ('first_name' in data)
|
||||
return `${data.last_name} ${data.first_name} ${data.middle_name}`
|
||||
|
||||
if ('represented_by' in data)
|
||||
return `${data.represented_by.last_name} ${data.represented_by.first_name} ${data.represented_by.middle_name}`
|
||||
getFullName(data: externalDataTypes | null): string {
|
||||
if (data) {
|
||||
if ('first_name' in data)
|
||||
return `${data.last_name} ${data.first_name} ${data.middle_name}`
|
||||
|
||||
if ('represented_by' in data)
|
||||
return `${data.represented_by.last_name} ${data.represented_by.first_name} ${data.represented_by.middle_name}`
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@ import type { Cooperative } from 'cooptypes'
|
||||
|
||||
export type IGenerateJoinCoopDecision = Cooperative.Documents.IGenerateJoinCoopDecision
|
||||
export type IGenerateJoinCoop = Cooperative.Documents.IGenerateJoinCoop
|
||||
export type IGenerateJoinProgram = Cooperative.Documents.IGenerateJoinProgram
|
||||
|
||||
@@ -25,7 +25,9 @@ class TransExtension {
|
||||
args.forEach((value, index) => {
|
||||
translation = translation.replace(new RegExp(`\\{${index}\\}`, 'g'), value)
|
||||
})
|
||||
return translation
|
||||
translation = translation.replace(/\n/g, '<br>')
|
||||
|
||||
return new nunjucks.runtime.SafeString(translation as unknown as string)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1 @@
|
||||
export * from './100.ParticipantApplication'
|
||||
export * from './registry'
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import * as ParticipantApplication from './100.ParticipantApplication'
|
||||
import * as DecisionOfParticipantApplication from './501.DecisionOfParticipantApplication'
|
||||
import * as ProgramProvision from './1000.ProgramProvision'
|
||||
|
||||
export const DocumentsRegistry = {
|
||||
100: ParticipantApplication.ParticipantApplicationTemplate,
|
||||
501: DecisionOfParticipantApplication.DecisionOfParticipantApplicationTemplate,
|
||||
1000: ProgramProvision.JoinProgramTemplate,
|
||||
}
|
||||
|
||||
export interface DocumentsMappingByActionAndCode {
|
||||
'registrator::joincoop': ParticipantApplication.IJoinCoopAction // Тип данных для документа 'registrator::joincoop'
|
||||
'registrator::joincoopdec': DecisionOfParticipantApplication.IJoinCoopDecisionAction // Тип данных для документа 'registrator::joincoopdec'
|
||||
'soviet::joinprog': ProgramProvision.IJoinProgram
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Filter, InsertOneResult, UpdateResult } from 'mongodb'
|
||||
import type { Cooperative as CooperativeModel } from 'cooptypes'
|
||||
import type { Actions, IFilterDocuments, IGeneratedDocument, externalDataTypes, externalDataTypesArrays, internalFilterTypes } from './Interfaces'
|
||||
import type { IGenerate } from './Interfaces/Documents'
|
||||
import { JoinCoop, JoinCoopDecision } from './Actions'
|
||||
import { JoinCoop, JoinCoopDecision, JoinProgram } from './Actions'
|
||||
import { MongoDBConnector } from './Services/Databazor'
|
||||
import type { ExternalIndividualData } from './Models/Individual'
|
||||
import { Individual } from './Models/Individual'
|
||||
@@ -57,6 +57,7 @@ export class Generator implements IGenerator {
|
||||
this.factories = {
|
||||
'registrator::joincoop': new JoinCoop.JoinCoopTemplateFactory(this.storage),
|
||||
'registrator::joincoopdec': new JoinCoopDecision.DecisionOfJoinCoopTemplateFactory(this.storage),
|
||||
'soviet::joinprog': new JoinProgram.JoinProgramTemplateFactory(this.storage),
|
||||
}
|
||||
await this.storage.connect()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeAll, beforeEach, describe, expect, it } from 'vitest'
|
||||
import type { RegistratorContract, SovietContract } from 'cooptypes'
|
||||
import { Generator } from '../src'
|
||||
import { Generator, type IGenerateJoinProgram } from '../src'
|
||||
import type { IGeneratedDocument } from '../src/Interfaces/Documents'
|
||||
import { saveBufferToDisk } from '../src/Utils/saveBufferToDisk'
|
||||
import { loadBufferFromDisk } from '../src/Utils/loadBufferFromDisk'
|
||||
@@ -298,15 +298,19 @@ describe('тест генератора документов', async () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('генерируем заявление на вступление физического лица', async () => {
|
||||
const document: IGeneratedDocument = await generator.generate({
|
||||
code: 'registrator',
|
||||
action: 'joincoop',
|
||||
it('генерируем заявление на присоединение к ЦПП', async () => {
|
||||
const params: IGenerateJoinProgram = {
|
||||
code: 'soviet',
|
||||
action: 'joinprog',
|
||||
coopname: 'voskhod',
|
||||
username: 'ant',
|
||||
lang: 'ru',
|
||||
signature: signatureExample,
|
||||
})
|
||||
registry_id: 1000,
|
||||
protocol_number: '01-01-2024',
|
||||
protocol_day_month_year: '1 января 2024 г.',
|
||||
}
|
||||
|
||||
const document: IGeneratedDocument = await generator.generate(params)
|
||||
|
||||
const filename1 = `${document.meta.title}-${document.meta.username}.pdf`
|
||||
await saveBufferToDisk(document.binary, filename1)
|
||||
@@ -314,6 +318,7 @@ describe('тест генератора документов', async () => {
|
||||
const regenerated_document: IGeneratedDocument = await generator.generate({
|
||||
...document.meta,
|
||||
})
|
||||
|
||||
const filename2 = `regenerated-${document.meta.title}-${document.meta.username}.pdf`
|
||||
await saveBufferToDisk(regenerated_document.binary, filename2)
|
||||
|
||||
@@ -331,205 +336,245 @@ describe('тест генератора документов', async () => {
|
||||
expect(getted_document).toBeDefined()
|
||||
expect(getted_document.hash).toEqual(document.hash)
|
||||
|
||||
// console.log('hash1: ', hash1)
|
||||
// console.log('hash2: ', hash2)
|
||||
console.log('hash1: ', hash1)
|
||||
console.log('hash2: ', hash2)
|
||||
// console.log(document)
|
||||
|
||||
expect(hash1).toEqual(hash2)
|
||||
|
||||
const decision_document: IGeneratedDocument = await generator.generate({
|
||||
code: 'registrator',
|
||||
action: 'joincoopdec',
|
||||
coopname: 'voskhod',
|
||||
username: 'ant',
|
||||
lang: 'ru',
|
||||
decision_id: 1,
|
||||
})
|
||||
|
||||
const filename3 = `${decision_document.meta.title}-${decision_document.meta.username}.pdf`
|
||||
await saveBufferToDisk(decision_document.binary, filename3)
|
||||
})
|
||||
|
||||
it('сохранение данных организации', async () => {
|
||||
const organizationData: ExternalOrganizationData = {
|
||||
username: 'exampleorg',
|
||||
type: 'ooo',
|
||||
is_cooperative: false,
|
||||
short_name: 'ExampleOrg',
|
||||
full_name: 'Примерная организация',
|
||||
represented_by: {
|
||||
first_name: 'Иван',
|
||||
last_name: 'Иванов',
|
||||
middle_name: 'Иванович',
|
||||
position: 'Директор',
|
||||
based_on: 'Устава организации',
|
||||
},
|
||||
country: 'Russia',
|
||||
city: 'Moscow',
|
||||
full_address: '456 Main St, Moscow, Russia',
|
||||
email: 'contact@exampleorg.com',
|
||||
phone: '+71234567890',
|
||||
details: {
|
||||
inn: '0987654321',
|
||||
ogrn: '0987654321098',
|
||||
},
|
||||
bank_account: {
|
||||
account_number: '40817810099910004312',
|
||||
currency: 'RUB',
|
||||
card_number: '0987654321098765',
|
||||
bank_name: 'Example Bank',
|
||||
details: {
|
||||
bik: '098765432',
|
||||
corr: '30101810400000000225',
|
||||
kpp: '098765432',
|
||||
},
|
||||
},
|
||||
}
|
||||
// it('генерируем заявление на вступление физического лица', async () => {
|
||||
// const document: IGeneratedDocument = await generator.generate({
|
||||
// code: 'registrator',
|
||||
// action: 'joincoop',
|
||||
// coopname: 'voskhod',
|
||||
// username: 'ant',
|
||||
// lang: 'ru',
|
||||
// signature: signatureExample,
|
||||
// })
|
||||
|
||||
const saved = await generator.save('organization', organizationData)
|
||||
// const filename1 = `${document.meta.title}-${document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(document.binary, filename1)
|
||||
|
||||
const organization = await generator.get('organization', { username: organizationData.username }) as any
|
||||
// const regenerated_document: IGeneratedDocument = await generator.generate({
|
||||
// ...document.meta,
|
||||
// })
|
||||
// const filename2 = `regenerated-${document.meta.title}-${document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(regenerated_document.binary, filename2)
|
||||
|
||||
expect(organization._id).toEqual(saved.insertedId)
|
||||
// expect(document.meta).toEqual(regenerated_document.meta)
|
||||
// expect(document.hash).toEqual(regenerated_document.hash)
|
||||
|
||||
Object.keys(organizationData).forEach((field) => {
|
||||
expect(organization[field]).toBeDefined()
|
||||
})
|
||||
})
|
||||
// const document_from_disk1 = await loadBufferFromDisk(filename1)
|
||||
// const document_from_disk2 = await loadBufferFromDisk(filename2)
|
||||
|
||||
it('генерируем заявление на вступление юридического лица', async () => {
|
||||
const document: IGeneratedDocument = await generator.generate({
|
||||
code: 'registrator',
|
||||
action: 'joincoop',
|
||||
coopname: 'voskhod',
|
||||
username: 'exampleorg',
|
||||
lang: 'ru',
|
||||
signature: signatureExample,
|
||||
})
|
||||
// const hash1 = calculateSha256(document_from_disk1)
|
||||
// const hash2 = calculateSha256(document_from_disk2)
|
||||
|
||||
const filename1 = `${document.meta.title}-${document.meta.username}.pdf`
|
||||
await saveBufferToDisk(document.binary, filename1)
|
||||
// const getted_document = await generator.getDocument({ hash: regenerated_document.hash })
|
||||
|
||||
const regenerated_document: IGeneratedDocument = await generator.generate({
|
||||
...document.meta,
|
||||
})
|
||||
// expect(getted_document).toBeDefined()
|
||||
// expect(getted_document.hash).toEqual(document.hash)
|
||||
|
||||
const filename2 = `regenerated-${document.meta.title}-${document.meta.username}.pdf`
|
||||
await saveBufferToDisk(regenerated_document.binary, filename2)
|
||||
// // console.log('hash1: ', hash1)
|
||||
// // console.log('hash2: ', hash2)
|
||||
// // console.log(document)
|
||||
|
||||
expect(document.meta).toEqual(regenerated_document.meta)
|
||||
expect(document.hash).toEqual(regenerated_document.hash)
|
||||
// expect(hash1).toEqual(hash2)
|
||||
|
||||
const document_from_disk1 = await loadBufferFromDisk(filename1)
|
||||
const document_from_disk2 = await loadBufferFromDisk(filename2)
|
||||
// const decision_document: IGeneratedDocument = await generator.generate({
|
||||
// code: 'registrator',
|
||||
// action: 'joincoopdec',
|
||||
// coopname: 'voskhod',
|
||||
// username: 'ant',
|
||||
// lang: 'ru',
|
||||
// decision_id: 1,
|
||||
// })
|
||||
|
||||
const hash1 = calculateSha256(document_from_disk1)
|
||||
const hash2 = calculateSha256(document_from_disk2)
|
||||
// const filename3 = `${decision_document.meta.title}-${decision_document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(decision_document.binary, filename3)
|
||||
// })
|
||||
|
||||
// console.log('hash1: ', hash1)
|
||||
// console.log('hash2: ', hash2)
|
||||
// console.log(document)
|
||||
// it('сохранение данных организации', async () => {
|
||||
// const organizationData: ExternalOrganizationData = {
|
||||
// username: 'exampleorg',
|
||||
// type: 'ooo',
|
||||
// is_cooperative: false,
|
||||
// short_name: 'ExampleOrg',
|
||||
// full_name: 'Примерная организация',
|
||||
// represented_by: {
|
||||
// first_name: 'Иван',
|
||||
// last_name: 'Иванов',
|
||||
// middle_name: 'Иванович',
|
||||
// position: 'Директор',
|
||||
// based_on: 'Устава организации',
|
||||
// },
|
||||
// country: 'Russia',
|
||||
// city: 'Moscow',
|
||||
// full_address: '456 Main St, Moscow, Russia',
|
||||
// email: 'contact@exampleorg.com',
|
||||
// phone: '+71234567890',
|
||||
// details: {
|
||||
// inn: '0987654321',
|
||||
// ogrn: '0987654321098',
|
||||
// },
|
||||
// bank_account: {
|
||||
// account_number: '40817810099910004312',
|
||||
// currency: 'RUB',
|
||||
// card_number: '0987654321098765',
|
||||
// bank_name: 'Example Bank',
|
||||
// details: {
|
||||
// bik: '098765432',
|
||||
// corr: '30101810400000000225',
|
||||
// kpp: '098765432',
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
|
||||
expect(hash1).toEqual(hash2)
|
||||
// const saved = await generator.save('organization', organizationData)
|
||||
|
||||
const decision_document: IGeneratedDocument = await generator.generate({
|
||||
code: 'registrator',
|
||||
action: 'joincoopdec',
|
||||
coopname: 'voskhod',
|
||||
username: 'exampleorg',
|
||||
lang: 'ru',
|
||||
decision_id: 2,
|
||||
})
|
||||
// const organization = await generator.get('organization', { username: organizationData.username }) as any
|
||||
|
||||
const filename3 = `${decision_document.meta.title}-${decision_document.meta.username}.pdf`
|
||||
await saveBufferToDisk(decision_document.binary, filename3)
|
||||
})
|
||||
// expect(organization._id).toEqual(saved.insertedId)
|
||||
|
||||
it('сохранение данных индивидуального предпринимателя', async () => {
|
||||
const entrepreneurData: ExternalEntrepreneurData = {
|
||||
username: 'entrepreneur',
|
||||
first_name: 'John',
|
||||
last_name: 'Doe',
|
||||
middle_name: 'Middle',
|
||||
birthdate: '2023-04-01',
|
||||
phone: '+1234567890',
|
||||
email: 'john.doe@example.com',
|
||||
full_address: 'переулок правды д. 1',
|
||||
country: 'Russia',
|
||||
city: 'Moscow',
|
||||
details: {
|
||||
inn: '0987654321',
|
||||
ogrn: '0987654321098',
|
||||
},
|
||||
bank_account: {
|
||||
account_number: '40817810099910004312',
|
||||
currency: 'RUB',
|
||||
card_number: '0987654321098765',
|
||||
bank_name: 'Example Bank',
|
||||
details: {
|
||||
bik: '098765432',
|
||||
corr: '30101810400000000225',
|
||||
kpp: '098765432',
|
||||
},
|
||||
},
|
||||
}
|
||||
// Object.keys(organizationData).forEach((field) => {
|
||||
// expect(organization[field]).toBeDefined()
|
||||
// })
|
||||
// })
|
||||
|
||||
const saved = await generator.save('entrepreneur', entrepreneurData)
|
||||
console.log(saved)
|
||||
const entrepreneur = await generator.get('entrepreneur', { username: entrepreneurData.username }) as any
|
||||
console.log(entrepreneur)
|
||||
expect(entrepreneur._id).toEqual(saved.insertedId)
|
||||
// it('генерируем заявление на вступление юридического лица', async () => {
|
||||
// const document: IGeneratedDocument = await generator.generate({
|
||||
// code: 'registrator',
|
||||
// action: 'joincoop',
|
||||
// coopname: 'voskhod',
|
||||
// username: 'exampleorg',
|
||||
// lang: 'ru',
|
||||
// signature: signatureExample,
|
||||
// })
|
||||
|
||||
Object.keys(entrepreneurData).forEach((field) => {
|
||||
expect(entrepreneur[field]).toBeDefined()
|
||||
})
|
||||
})
|
||||
// const filename1 = `${document.meta.title}-${document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(document.binary, filename1)
|
||||
|
||||
it('генерируем заявление на вступление индивидуального предпринимателя', async () => {
|
||||
const document: IGeneratedDocument = await generator.generate({
|
||||
code: 'registrator',
|
||||
action: 'joincoop',
|
||||
coopname: 'voskhod',
|
||||
username: 'entrepreneur',
|
||||
lang: 'ru',
|
||||
signature: signatureExample,
|
||||
})
|
||||
// const regenerated_document: IGeneratedDocument = await generator.generate({
|
||||
// ...document.meta,
|
||||
// })
|
||||
|
||||
const filename1 = `${document.meta.title}-${document.meta.username}.pdf`
|
||||
await saveBufferToDisk(document.binary, filename1)
|
||||
// const filename2 = `regenerated-${document.meta.title}-${document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(regenerated_document.binary, filename2)
|
||||
|
||||
const regenerated_document: IGeneratedDocument = await generator.generate({
|
||||
...document.meta,
|
||||
})
|
||||
// expect(document.meta).toEqual(regenerated_document.meta)
|
||||
// expect(document.hash).toEqual(regenerated_document.hash)
|
||||
|
||||
const filename2 = `regenerated-${document.meta.title}-${document.meta.username}.pdf`
|
||||
await saveBufferToDisk(regenerated_document.binary, filename2)
|
||||
// const document_from_disk1 = await loadBufferFromDisk(filename1)
|
||||
// const document_from_disk2 = await loadBufferFromDisk(filename2)
|
||||
|
||||
expect(document.meta).toEqual(regenerated_document.meta)
|
||||
expect(document.hash).toEqual(regenerated_document.hash)
|
||||
// const hash1 = calculateSha256(document_from_disk1)
|
||||
// const hash2 = calculateSha256(document_from_disk2)
|
||||
|
||||
const document_from_disk1 = await loadBufferFromDisk(filename1)
|
||||
const document_from_disk2 = await loadBufferFromDisk(filename2)
|
||||
// // console.log('hash1: ', hash1)
|
||||
// // console.log('hash2: ', hash2)
|
||||
// // console.log(document)
|
||||
|
||||
const hash1 = calculateSha256(document_from_disk1)
|
||||
const hash2 = calculateSha256(document_from_disk2)
|
||||
// expect(hash1).toEqual(hash2)
|
||||
|
||||
// console.log('hash1: ', hash1)
|
||||
// console.log('hash2: ', hash2)
|
||||
// console.log(document)
|
||||
// const decision_document: IGeneratedDocument = await generator.generate({
|
||||
// code: 'registrator',
|
||||
// action: 'joincoopdec',
|
||||
// coopname: 'voskhod',
|
||||
// username: 'exampleorg',
|
||||
// lang: 'ru',
|
||||
// decision_id: 2,
|
||||
// })
|
||||
|
||||
expect(hash1).toEqual(hash2)
|
||||
// const filename3 = `${decision_document.meta.title}-${decision_document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(decision_document.binary, filename3)
|
||||
// })
|
||||
|
||||
const decision_document: IGeneratedDocument = await generator.generate({
|
||||
code: 'registrator',
|
||||
action: 'joincoopdec',
|
||||
coopname: 'voskhod',
|
||||
username: 'entrepreneur',
|
||||
lang: 'ru',
|
||||
decision_id: 3,
|
||||
})
|
||||
// it('сохранение данных индивидуального предпринимателя', async () => {
|
||||
// const entrepreneurData: ExternalEntrepreneurData = {
|
||||
// username: 'entrepreneur',
|
||||
// first_name: 'John',
|
||||
// last_name: 'Doe',
|
||||
// middle_name: 'Middle',
|
||||
// birthdate: '2023-04-01',
|
||||
// phone: '+1234567890',
|
||||
// email: 'john.doe@example.com',
|
||||
// full_address: 'переулок правды д. 1',
|
||||
// country: 'Russia',
|
||||
// city: 'Moscow',
|
||||
// details: {
|
||||
// inn: '0987654321',
|
||||
// ogrn: '0987654321098',
|
||||
// },
|
||||
// bank_account: {
|
||||
// account_number: '40817810099910004312',
|
||||
// currency: 'RUB',
|
||||
// card_number: '0987654321098765',
|
||||
// bank_name: 'Example Bank',
|
||||
// details: {
|
||||
// bik: '098765432',
|
||||
// corr: '30101810400000000225',
|
||||
// kpp: '098765432',
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
|
||||
const filename3 = `${decision_document.meta.title}-${decision_document.meta.username}.pdf`
|
||||
await saveBufferToDisk(decision_document.binary, filename3)
|
||||
})
|
||||
// const saved = await generator.save('entrepreneur', entrepreneurData)
|
||||
// console.log(saved)
|
||||
// const entrepreneur = await generator.get('entrepreneur', { username: entrepreneurData.username }) as any
|
||||
// console.log(entrepreneur)
|
||||
// expect(entrepreneur._id).toEqual(saved.insertedId)
|
||||
|
||||
// Object.keys(entrepreneurData).forEach((field) => {
|
||||
// expect(entrepreneur[field]).toBeDefined()
|
||||
// })
|
||||
// })
|
||||
|
||||
// it('генерируем заявление на вступление индивидуального предпринимателя', async () => {
|
||||
// const document: IGeneratedDocument = await generator.generate({
|
||||
// code: 'registrator',
|
||||
// action: 'joincoop',
|
||||
// coopname: 'voskhod',
|
||||
// username: 'entrepreneur',
|
||||
// lang: 'ru',
|
||||
// signature: signatureExample,
|
||||
// })
|
||||
|
||||
// const filename1 = `${document.meta.title}-${document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(document.binary, filename1)
|
||||
|
||||
// const regenerated_document: IGeneratedDocument = await generator.generate({
|
||||
// ...document.meta,
|
||||
// })
|
||||
|
||||
// const filename2 = `regenerated-${document.meta.title}-${document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(regenerated_document.binary, filename2)
|
||||
|
||||
// expect(document.meta).toEqual(regenerated_document.meta)
|
||||
// expect(document.hash).toEqual(regenerated_document.hash)
|
||||
|
||||
// const document_from_disk1 = await loadBufferFromDisk(filename1)
|
||||
// const document_from_disk2 = await loadBufferFromDisk(filename2)
|
||||
|
||||
// const hash1 = calculateSha256(document_from_disk1)
|
||||
// const hash2 = calculateSha256(document_from_disk2)
|
||||
|
||||
// // console.log('hash1: ', hash1)
|
||||
// // console.log('hash2: ', hash2)
|
||||
// // console.log(document)
|
||||
|
||||
// expect(hash1).toEqual(hash2)
|
||||
|
||||
// const decision_document: IGeneratedDocument = await generator.generate({
|
||||
// code: 'registrator',
|
||||
// action: 'joincoopdec',
|
||||
// coopname: 'voskhod',
|
||||
// username: 'entrepreneur',
|
||||
// lang: 'ru',
|
||||
// decision_id: 3,
|
||||
// })
|
||||
|
||||
// const filename3 = `${decision_document.meta.title}-${decision_document.meta.username}.pdf`
|
||||
// await saveBufferToDisk(decision_document.binary, filename3)
|
||||
// })
|
||||
})
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.20](https://github.com/coopenomics/cooptypes/compare/cooptypes@1.0.20-alpha.1...cooptypes@1.0.20) (2024-08-25)
|
||||
|
||||
**Note:** Version bump only for package cooptypes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.19](https://github.com/coopenomics/cooptypes/compare/cooptypes@1.0.18...cooptypes@1.0.19) (2024-08-13)
|
||||
|
||||
**Note:** Version bump only for package cooptypes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cooptypes",
|
||||
"type": "module",
|
||||
"version": "1.0.20-alpha.1",
|
||||
"version": "1.0.20",
|
||||
"description": "_description_",
|
||||
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -72,6 +72,14 @@ export interface IComplexAgenda extends IAgenda {
|
||||
documents: IComplexDocument
|
||||
}
|
||||
|
||||
export interface IGetResponse<T> {
|
||||
results: T[]
|
||||
page: number
|
||||
limit: number
|
||||
totalResults: number
|
||||
totalPages: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Общий интерфейс для генерации/регенерации документа
|
||||
*/
|
||||
@@ -92,10 +100,9 @@ export interface IGenerateJoinCoopDecision extends IGenerate {
|
||||
decision_id: number
|
||||
}
|
||||
|
||||
export interface IGetResponse<T> {
|
||||
results: T[]
|
||||
page: number
|
||||
limit: number
|
||||
totalResults: number
|
||||
totalPages: number
|
||||
/** Интерфейс генерации документа для присоединения к программе ЦПП */
|
||||
export interface IGenerateJoinProgram extends IGenerate {
|
||||
registry_id: number
|
||||
protocol_number: string
|
||||
protocol_day_month_year: string
|
||||
}
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.0.24](https://github.com/copenomics/coop-notificator/compare/coop-notificator@0.0.24-alpha.1...coop-notificator@0.0.24) (2024-08-25)
|
||||
|
||||
**Note:** Version bump only for package coop-notificator
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.23](https://github.com/copenomics/coop-notificator/compare/coop-notificator@0.0.22...coop-notificator@0.0.23) (2024-08-13)
|
||||
|
||||
**Note:** Version bump only for package coop-notificator
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coop-notificator",
|
||||
"type": "module",
|
||||
"version": "0.0.24-alpha.1",
|
||||
"version": "0.0.24",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.1.1",
|
||||
"description": "_description_",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.1.35](https://github.com/coopenomics/monocoop/compare/terminal@0.1.35-alpha.1...terminal@0.1.35) (2024-08-25)
|
||||
|
||||
**Note:** Version bump only for package terminal
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.1.34](https://github.com/coopenomics/monocoop/compare/terminal@0.1.33...terminal@0.1.34) (2024-08-13)
|
||||
|
||||
**Note:** Version bump only for package terminal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "terminal",
|
||||
"version": "0.1.35-alpha.1",
|
||||
"version": "0.1.35",
|
||||
"description": "A Terminal Project",
|
||||
"productName": "Terminal App",
|
||||
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
||||
|
||||
Reference in New Issue
Block a user