This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { CacheManagerModule } from '@app/infra/persistence/cache/cache.module'; | |
import { OrderController } from './order.controller'; | |
import { ProductController } from './product.controller'; | |
import { UserController } from './user.controller'; | |
import { CreateOrderUseCase } from '@app/application/ecommerce/use-case/create-order'; | |
import { CreateProductUseCase } from '@app/application/ecommerce/use-case/create-product'; | |
import { CreateUserUseCase } from '@app/application/ecommerce/use-case/create-user'; | |
import { GetOrderUseCase } from '@app/application/ecommerce/use-case/get-order'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Entity } from "@app/core/entities/entity"; | |
export interface ProductProps { | |
id?: string | |
title: string | |
price: number | |
} | |
export class Product extends Entity<ProductProps> { | |
constructor(props: ProductProps) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const trx = await Database.beginTransaction(); | |
const user = await User.findOrFail(id); | |
if (!user) { | |
throw new JsonException('Usuário não localizado', 400); | |
} | |
try { | |
await user.merge(data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { test, trait, beforeEach } = use('Test/Suite')('User registration'); | |
const Factory = use('Factory'); | |
const Database = use('Database'); | |
const User = use('App/Models/User'); | |
const Permissions = use('App/Models/Permissions'); | |
const UserService = use('App/Services/UserService'); | |
const userService = new UserService(); | |
trait('DatabaseTransactions'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Application Routes | |
|-------------------------------------------------------------------------- | |
| | |
| Here is where you can register all of the routes for an application. | |
| It is a breeze. Simply tell Lumen the URIs it should respond to | |
| and give it the Closure to call when that URI is requested. | |
| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_NAME=Lumen | |
APP_ENV=local | |
APP_KEY=11111111111111111111111111111111 | |
APP_DEBUG=true | |
APP_URL=http://localhost | |
APP_TIMEZONE=UTC | |
LOG_CHANNEL=stack | |
LOG_SLACK_WEBHOOK_URL= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$factory->define(App\Users::class, function (Faker\Generator $faker) { | |
return [ | |
'name' => $faker->name, | |
'lastname' => $faker->lastName, | |
'email' => $faker->email, | |
'telephone' => $faker->phoneNumber, | |
]; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateMessagesTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateUsersTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Messages extends Model { | |
protected $fillable = [ | |
"id", | |
"user_id", | |
"description", | |
"created_at", | |
"updated_at" | |
]; |
NewerOlder