Skip to content

Commit

Permalink
Merge pull request #16 from CinCoders/develop
Browse files Browse the repository at this point in the history
Version 1.2.0
  • Loading branch information
dcruzb authored Jan 25, 2024
2 parents e62edcc + 09bb08b commit dd982ae
Show file tree
Hide file tree
Showing 15 changed files with 288 additions and 51 deletions.
29 changes: 21 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "research-back",
"version": "1.0.0",
"version": "1.2.0",
"description": "Research Dashboard API - System to display information extracted from professors' Lattes curriculum.",
"license": "MIT",
"author": "CInCoders <[email protected]> (https://cincoders.cin.ufpe.br)",
Expand Down Expand Up @@ -58,6 +58,7 @@
"@types/node": "^16.18.30",
"@types/string-similarity": "^4.0.0",
"@types/supertest": "^2.0.11",
"@types/uuid": "^9.0.6",
"@types/validator": "^13.7.1",
"@types/xml2js": "^0.4.9",
"@typescript-eslint/eslint-plugin": "^5.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/app.datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { ArtisticProduction } from './professor/entities/artisticProduction.enti
import { CreateBookAndPatentAndArtisticProduction1702905182255 } from './database/migrations/1702905182255-createBookAndPatentAndArtisticProduction';
import { Scholarship } from './scholarship/entities/scholarship.entity';
import { CreateScholarship1703094449669 } from './database/migrations/1703094449669-createScholarship';
import { alterTableImportXml1705606892154 } from './database/migrations/1705606892154-alterTableImportXml';

config();

Expand Down Expand Up @@ -68,5 +69,6 @@ export const AppDataSource = new DataSource({
importXmlRefactoring1683838256398,
CreateBookAndPatentAndArtisticProduction1702905182255,
CreateScholarship1703094449669,
alterTableImportXml1705606892154,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class CreateBookAndPatentAndArtisticProduction1702905182255
`CREATE TABLE "book" ("id" integer GENERATED BY DEFAULT AS IDENTITY NOT NULL, "title" character varying NOT NULL, "language" character varying NOT NULL, "year" integer NOT NULL, "publicationCountry" character varying NOT NULL, "bigArea" character varying, "area" character varying, "subArea" character varying, "speciality" character varying, "authors" character varying(1500), "professor_id" integer, CONSTRAINT "PK_a3afef72ec8f80e6e5c310b28a4" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TABLE "patent" ("id" integer GENERATED BY DEFAULT AS IDENTITY NOT NULL, "title" character varying NOT NULL, "developmentYear" character varying NOT NULL, "country" character varying NOT NULL, "situationStatus" character varying NOT NULL, "category" character varying NOT NULL, "patentType" character varying, "registryCode" character varying, "depositRegistrationInstitution" character varying, "depositantName" character varying, "authors" character varying(1500), "professor_id" integer, CONSTRAINT "PK_96dffa9f77a7b6bf84dea124cbd" PRIMARY KEY ("id"))`,
`CREATE TABLE "patent" ("id" integer GENERATED BY DEFAULT AS IDENTITY NOT NULL, "title" character varying NOT NULL, "developmentYear" character varying NOT NULL, "country" character varying NOT NULL, "situationStatus" character varying NOT NULL, "category" character varying, "patentType" character varying, "registryCode" character varying, "depositRegistrationInstitution" character varying, "depositantName" character varying, "authors" character varying(1500), "professor_id" integer, CONSTRAINT "PK_96dffa9f77a7b6bf84dea124cbd" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TABLE "artistic_production" ("id" integer GENERATED BY DEFAULT AS IDENTITY NOT NULL, "title" character varying NOT NULL, "language" character varying NOT NULL, "year" integer NOT NULL, "country" character varying NOT NULL, "authorActivity" character varying, "promotingInstitution" character varying, "bigArea" character varying, "area" character varying, "subArea" character varying, "speciality" character varying, "authors" character varying(1500), "professor_id" integer, CONSTRAINT "PK_f516e2aef25e7034d8577f22429" PRIMARY KEY ("id"))`,
Expand Down
17 changes: 17 additions & 0 deletions src/database/migrations/1705606892154-alterTableImportXml.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class alterTableImportXml1705606892154 implements MigrationInterface {
name = 'alterTableImportXml1705606892154';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "xml_imports" ADD COLUMN "stored_xml" BOOLEAN DEFAULT false`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "xml_imports" DROP COLUMN "stored_xml"`,
);
}
}
2 changes: 2 additions & 0 deletions src/import-xml/dto/import-xml.dto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export class ImportXmlDto {
id!: string;
name!: string;
professor?: string;
user!: string;
status!: string;
storedXml!: boolean;
includedAt!: Date;
importTime?: number;
}
4 changes: 4 additions & 0 deletions src/import-xml/entities/import-xml.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class ImportXml {
@Column({ name: 'status' })
status!: string;

@ApiProperty()
@Column({ name: 'stored_xml' })
storedXml!: boolean;

@ApiProperty()
@CreateDateColumn({ name: 'included_at', type: 'timestamptz' })
includedAt!: Date;
Expand Down
11 changes: 11 additions & 0 deletions src/import-xml/import-xml.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Controller,
Get,
Param,
Post,
Query,
Res,
Expand Down Expand Up @@ -75,4 +76,14 @@ export class ImportXmlController {
});
return res.status(200).send(importedXmls);
}

@ApiResponse({
status: 200,
description: 'Reprocesses the xml with the given id',
})
@Get(':id/reprocess')
async reprocessXML(@Res() res: Response, @Param('id') id: string) {
const importedXml = await this.importXmlService.reprocessXML(id);
return res.status(200).send(importedXml);
}
}
Loading

0 comments on commit dd982ae

Please sign in to comment.