.
This commit is contained in:
parent
0ae16f2d9f
commit
84661b06dd
13
.prettierrc
13
.prettierrc
@ -1,13 +0,0 @@
|
||||
{
|
||||
"bracketSpacing": true,
|
||||
"useTabs": false,
|
||||
"printWidth": 100,
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "es5",
|
||||
"jsxSingleQuote": true,
|
||||
"jsxBracketSameLine": false,
|
||||
"arrowParens": "always",
|
||||
"rcVerbose": true
|
||||
}
|
||||
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["esbenp.prettier-vscode", "biomejs.biome"]
|
||||
}
|
||||
17
.vscode/launch.json
vendored
17
.vscode/launch.json
vendored
@ -1,6 +1,23 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "SERVER: Run in Development Mode",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": ["run", "dev"],
|
||||
"console": "integratedTerminal"
|
||||
},
|
||||
{
|
||||
"name": "SERVER: Run in Production Mode",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": ["run", "start"],
|
||||
"console": "integratedTerminal",
|
||||
"preLaunchTask": "npm: build"
|
||||
},
|
||||
{
|
||||
"name": "Attach to Turbo Server API (ts-node-dev)",
|
||||
"type": "node",
|
||||
|
||||
15
.vscode/settings.json
vendored
15
.vscode/settings.json
vendored
@ -17,15 +17,18 @@
|
||||
"typescript.preferences.importModuleSpecifier": "shortest",
|
||||
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "explicit",
|
||||
"source.fixAll.eslint": "explicit"
|
||||
"source.fixAll": "explicit",
|
||||
"source.fixAll.biome": "explicit",
|
||||
"source.organizeImports.biome": "explicit",
|
||||
"source.removeUnusedImports": "explicit"
|
||||
},
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnPaste": false,
|
||||
"prettier.useEditorConfig": false,
|
||||
"prettier.useTabs": false,
|
||||
"prettier.configPath": ".prettierrc",
|
||||
|
||||
"[javascript][typescript][json][jsonc]": {
|
||||
"editor.defaultFormatter": "biomejs.biome"
|
||||
},
|
||||
|
||||
// other vscode settings
|
||||
"[handlebars]": {
|
||||
|
||||
@ -6,7 +6,12 @@ import {
|
||||
UniqueID,
|
||||
} from "@/core/common/domain";
|
||||
|
||||
import { Account, AccountStatus, IAccountProps, IAccountService } from "@/contexts/accounts/domain";
|
||||
import {
|
||||
type Account,
|
||||
AccountStatus,
|
||||
type IAccountProps,
|
||||
type IAccountService,
|
||||
} from "@/contexts/accounts/domain";
|
||||
import { Maybe, Result } from "@/core/common/helpers";
|
||||
import { ITransactionManager } from "@/core/common/infrastructure/database";
|
||||
import { logger } from "@/core/common/infrastructure/logger";
|
||||
@ -1,7 +1,6 @@
|
||||
import { Account, IAccountService } from "@/contexts/accounts/domain";
|
||||
import { Collection, Result } from "@/core/common/helpers";
|
||||
import { ITransactionManager } from "@/core/common/infrastructure/database";
|
||||
import { logger } from "@/core/common/infrastructure/logger";
|
||||
|
||||
export class ListAccountsUseCase {
|
||||
constructor(
|
||||
@ -1,11 +1,11 @@
|
||||
import {
|
||||
AggregateRoot,
|
||||
EmailAddress,
|
||||
PhoneNumber,
|
||||
type EmailAddress,
|
||||
type PhoneNumber,
|
||||
PostalAddress,
|
||||
TINNumber,
|
||||
type TINNumber,
|
||||
UniqueID,
|
||||
} from "@/core/common/domain";
|
||||
} from "@/core";
|
||||
import { Maybe, Result } from "@/core/common/helpers";
|
||||
import { AccountStatus } from "../value-objects";
|
||||
|
||||
@ -58,6 +58,7 @@ export interface IAccount {
|
||||
}
|
||||
|
||||
export class Account extends AggregateRoot<IAccountProps> implements IAccount {
|
||||
id: UniqueID;
|
||||
static create(props: IAccountProps, id?: UniqueID): Result<Account, Error> {
|
||||
const account = new Account(props, id);
|
||||
|
||||
@ -8,8 +8,8 @@ import {
|
||||
} from "@/core/common/domain";
|
||||
import { Maybe, Result } from "@/core/common/helpers";
|
||||
import {
|
||||
ISequelizeMapper,
|
||||
MapperParamsType,
|
||||
type ISequelizeMapper,
|
||||
type MapperParamsType,
|
||||
SequelizeMapper,
|
||||
} from "@/core/common/infrastructure/sequelize/sequelize-mapper";
|
||||
import { AccountCreationAttributes, AccountModel } from "../sequelize/account.model";
|
||||
@ -4,7 +4,7 @@ import { EmailAddress, UniqueID } from "@/core/common/domain";
|
||||
import { Collection, Result } from "@/core/common/helpers";
|
||||
import { SequelizeRepository } from "@/core/common/infrastructure";
|
||||
import { Transaction } from "sequelize";
|
||||
import { accountMapper, IAccountMapper } from "../mappers/account.mapper";
|
||||
import { IAccountMapper, accountMapper } from "../mappers/account.mapper";
|
||||
import { AccountModel } from "./account.model";
|
||||
|
||||
class AccountRepository extends SequelizeRepository<Account> implements IAccountRepository {
|
||||
@ -1,4 +1,4 @@
|
||||
export interface IListAccountsRequestDTO {}
|
||||
export type IListAccountsRequestDTO = {}
|
||||
|
||||
export interface ICreateAccountRequestDTO {
|
||||
id: string;
|
||||
@ -33,8 +33,8 @@ export class AuthenticatedUser
|
||||
extends AggregateRoot<IAuthenticatedUserProps>
|
||||
implements IAuthenticatedUser
|
||||
{
|
||||
public accessToken: string = "";
|
||||
public refreshToken: string = "";
|
||||
public accessToken = "";
|
||||
public refreshToken = "";
|
||||
|
||||
static create(props: IAuthenticatedUserProps, id: UniqueID): Result<AuthenticatedUser, Error> {
|
||||
const user = new AuthenticatedUser(props, id);
|
||||
@ -1,9 +1,9 @@
|
||||
import { AggregateRoot, UniqueID } from "@/core/common/domain";
|
||||
import { Result } from "@/core/common/helpers";
|
||||
|
||||
export interface IRoleProps {}
|
||||
export type IRoleProps = {};
|
||||
|
||||
export interface IRole {}
|
||||
export type IRole = {};
|
||||
|
||||
export class Role extends AggregateRoot<IRoleProps> implements IRole {
|
||||
static create(props: IRoleProps, id: UniqueID): Result<Role, Error> {
|
||||
@ -0,0 +1 @@
|
||||
export type IUserPermissionRepository = {}
|
||||
@ -1,6 +1,13 @@
|
||||
import { EmailAddress } from "@/core/common/domain";
|
||||
import { Result } from "@/core/common/helpers";
|
||||
import { AuthenticatedUser, IJWTPayload, LoginData, RegisterData, TabContext, Token } from "..";
|
||||
import {
|
||||
AuthenticatedUser,
|
||||
type IJWTPayload,
|
||||
type LoginData,
|
||||
type RegisterData,
|
||||
TabContext,
|
||||
Token,
|
||||
} from "..";
|
||||
|
||||
import { UniqueID } from "@/core/common/domain";
|
||||
import { IAuthenticatedUserRepository, JWTPayload } from "..";
|
||||
@ -28,4 +28,8 @@ export class UserRoles extends ValueObject<UserRolesProps> {
|
||||
getValue() {
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
toPrimitive() {
|
||||
return this.props.value;
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
import bcrypt from "bcrypt";
|
||||
import { ValueObject } from "@/core/common/domain";
|
||||
import { Result } from "@/core/common/helpers";
|
||||
import { z } from "zod";
|
||||
@ -29,4 +29,9 @@ export class PlainPassword extends ValueObject<PlainPasswordProps> {
|
||||
toString() {
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
toPrimitive() {
|
||||
return this.props.value;
|
||||
|
||||
}
|
||||
}
|
||||
@ -29,4 +29,9 @@ export class Token extends ValueObject<TokenProps> {
|
||||
toString() {
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
toPrimitive() {
|
||||
return this.props.value;
|
||||
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,8 @@ import {
|
||||
SequelizeMapper,
|
||||
UniqueID,
|
||||
} from "@/core";
|
||||
import { AuthenticatedUser, HashPassword, Username } from "../../domain";
|
||||
import { AuthUserCreationAttributes, AuthUserModel } from "../sequelize";
|
||||
import { AuthUserCreationAttributes, AuthUserModel } from '../sequelize';
|
||||
import { AuthenticatedUser, HashPassword, Username } from '../../domain';
|
||||
|
||||
export interface IAuthenticatedUserMapper
|
||||
extends ISequelizeMapper<AuthUserModel, AuthUserCreationAttributes, AuthenticatedUser> {}
|
||||
@ -52,8 +52,8 @@ export class AuthenticatedUserMapper
|
||||
public mapToPersistence(
|
||||
source: AuthenticatedUser,
|
||||
params?: MapperParamsType
|
||||
): Result<AuthUserCreationAttributes, Error> {
|
||||
return Result.ok({
|
||||
): AuthUserCreationAttributes {
|
||||
return {
|
||||
id: source.id.toString(),
|
||||
username: source.username.toString(),
|
||||
email: source.email.toString(),
|
||||
@ -61,7 +61,7 @@ export class AuthenticatedUserMapper
|
||||
roles: source.getRoles().map((role) => role.toString()),
|
||||
//access_token: source.accessToken,
|
||||
//refresh_token: source.refreshToken,
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import { UniqueID } from "@/core/common/domain";
|
||||
import { Result } from "@/core/common/helpers";
|
||||
import { ISequelizeMapper, MapperParamsType, SequelizeMapper } from "@/core/common/infrastructure";
|
||||
import {
|
||||
type ISequelizeMapper,
|
||||
type MapperParamsType,
|
||||
SequelizeMapper,
|
||||
} from "@/core/common/infrastructure";
|
||||
import { TabContext } from "../../domain";
|
||||
import { TabContextCreationAttributes, TabContextModel } from "../sequelize";
|
||||
|
||||
@ -49,12 +53,12 @@ export class TabContextMapper
|
||||
public mapToPersistence(
|
||||
source: TabContext,
|
||||
params?: MapperParamsType
|
||||
): Result<TabContextCreationAttributes, Error> {
|
||||
return Result.ok({
|
||||
): TabContextCreationAttributes {
|
||||
return {
|
||||
id: source.id.toString(),
|
||||
tab_id: source.tabId.toString(),
|
||||
user_id: source.userId.toString(),
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { EmailAddress, UniqueID } from "@/core/common/domain";
|
||||
import { Result } from "@/core/common/helpers";
|
||||
import {
|
||||
ISequelizeMapper,
|
||||
MapperParamsType,
|
||||
type ISequelizeMapper,
|
||||
type MapperParamsType,
|
||||
SequelizeMapper,
|
||||
} from "@/core/common/infrastructure/sequelize/sequelize-mapper";
|
||||
import { User, Username } from "../../domain";
|
||||
@ -38,16 +38,13 @@ class UserMapper
|
||||
);
|
||||
}
|
||||
|
||||
public mapToPersistence(
|
||||
source: User,
|
||||
params?: MapperParamsType
|
||||
): Result<UserCreationAttributes, Error> {
|
||||
return Result.ok({
|
||||
public mapToPersistence(source: User, params?: MapperParamsType): UserCreationAttributes {
|
||||
return {
|
||||
id: source.id.toString(),
|
||||
username: source.username.toString(),
|
||||
email: source.email.toString(),
|
||||
//roles: source.getRoles().map((role) => role.toString()),
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { UniqueID } from "@/core/common/domain";
|
||||
import { ApiError, ExpressController } from "@/core/common/presentation";
|
||||
import { AuthenticatedUser } from "../../domain";
|
||||
//import { authProvider } from "@/contexts/auth/infraestructure";
|
||||
import { NextFunction, Response } from "express";
|
||||
import { AuthenticatedUser } from "../../domain";
|
||||
import { AuthenticatedRequest } from "../express/types";
|
||||
import { authProvider } from "../passport";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user