Skip to content

Commit

Permalink
style(backend): reoganize dtos
Browse files Browse the repository at this point in the history
  • Loading branch information
guesant committed Feb 13, 2024
1 parent d80da39 commit 032845e
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 21 deletions.
5 changes: 3 additions & 2 deletions luna-backend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all"
}
"trailingComma": "all",
"printWidth": 200
}
5 changes: 4 additions & 1 deletion luna-backend/src/application/authz/AuthzPublicProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import { BaseAuthzProvider } from '../../infrastructure/authz/authz-provider/Bas
export class AuthzPublicProvider extends BaseAuthzProvider {
getStatements() {
return [
// ...
//
this.estadoFind,
//
this.cidadeFind,
//
this.campusFind,
this.campusCreate,
this.campusUpdate,
this.campusDelete,
//
];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ICampusFindOneByIdInputDto } from '../campus-find-one';

export interface ICampusDeleteOneByIdInputDto extends ICampusFindOneByIdInputDto {
export interface ICampusDeleteOneByIdInputDto
extends ICampusFindOneByIdInputDto {
id: string;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ICampusModel } from '../../../(models)/ICampusModel';
import { ICampusModel } from '../../(models)/ICampusModel';

export interface ICampusFindOneByIdInputDto extends Pick<ICampusModel, 'id'> {
id: string;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './ICampusFindOneByIdInputDto';
export * from './ICampusFindOneResultDto';
export * from './campus-find-one-by-id';
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { ICampusInputDto } from '../ICampusInputDto';
import { ICampusInputDto } from './ICampusInputDto';

export interface ICampusCreateDto extends ICampusInputDto {}
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { IEnderecoInputDto } from '../../../../endereco';
import { ICampusFindOneByIdInputDto } from '../../campus-find-one';
import { ICampusInputDto } from '../ICampusInputDto';
import { IEnderecoInputDto } from '../../../endereco';
import { ICampusFindOneByIdInputDto } from '../campus-find-one';
import { ICampusInputDto } from './ICampusInputDto';

export interface ICampusUpdateDto
extends ICampusFindOneByIdInputDto,
Partial<ICampusInputDto> {
//

id: string;

//

razaoSocial?: string;
nomeFantasia?: string;
apelido?: string;
cnpj?: string;

//

endereco?: IEnderecoInputDto;

//
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './ICampusCreateDto';
export * from './ICampusInputDto';
export * from './campus-create';
export * from './campus-update';
export * from './ICampusUpdateDto';
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { IDatedObject, IObjectUuid } from '../../../(core)';
import { IDatedObject, IEntityDate, IObjectUuid } from '../../../(core)';
import { IEnderecoModel } from '../../endereco';

export interface ICampusModel extends IObjectUuid, IDatedObject {
//

id: string;

//

razaoSocial: string;
nomeFantasia: string;
apelido: string;
Expand All @@ -12,4 +16,12 @@ export interface ICampusModel extends IObjectUuid, IDatedObject {
//

endereco: IEnderecoModel;

//

dateCreated: IEntityDate;
dateUpdated: IEntityDate;
dateDeleted: null | IEntityDate;

//
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IEnderecoModel } from '../../../(models)';
import { IEnderecoModel } from '../../(models)';

export interface IEnderecoFindOneByIdInputDto {
id: IEnderecoModel['id'];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './IEnderecoFindOneByIdInputDto';
export * from './IEnderecoFindOneResultDto';
export * from './endereco-find-one-by-id';
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { IDatedObject, IObjectUuid } from '../../../(core)';
import { IDatedObject, IEntityDate, IObjectUuid } from '../../../(core)';
import { ICidadeModel } from '../../base-cidade';

export interface IEnderecoModel extends IObjectUuid, IDatedObject {
//

id: string;

//

cep: string;
logradouro: string;

Expand All @@ -18,4 +22,10 @@ export interface IEnderecoModel extends IObjectUuid, IDatedObject {
cidade: ICidadeModel;

//

dateCreated: IEntityDate;
dateUpdated: IEntityDate;
dateDeleted: null | IEntityDate;

//
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class CampusController {
@HttpDtoBody(CampusOperations.CAMPUS_UPDATE)
dto: Omit<ICampusUpdateDto, 'id'>,
) {
const dtoUpdate = <ICampusUpdateDto>{
const dtoUpdate: ICampusUpdateDto = {
...dto,
id,
};
Expand Down

0 comments on commit 032845e

Please sign in to comment.