change migration name

This commit is contained in:
2025-05-04 12:58:18 +03:30
parent 314645761b
commit 67efae2875
7 changed files with 20 additions and 22 deletions

View File

@@ -21,9 +21,9 @@ services:
ports:
- "8070:5432"
environment:
POSTGRES_DB: ${NOTIFICATION_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${NOTIFICATION_SERVER_DB}
POSTGRES_USER: ${NOTIFICATION_SERVER_USER}
POSTGRES_PASSWORD: ${NOTIFICATION_SERVER_PASSWORD}
volumes:
- ./notification:/var/lib/postgresql/data
profiles:
@@ -49,7 +49,7 @@ services:
networks:
- notification
depends_on:
- postgres
- backend_db
notification_server:
build:
@@ -67,7 +67,7 @@ services:
- DB_SYNC=${NOTIFICATION_SERVER_DB_SYNC}
- PORT=${NOTIFICATION_SERVER_PORT}
ports:
- "3023:3023"
- "3023:${NOTIFICATION_SERVER_PORT}"
volumes:
- ${NOTIFICATION_SERVER_PATH}:/var/www/crm-notification-server
profiles:
@@ -75,7 +75,7 @@ services:
networks:
- notification
depends_on:
- backend-db
- backend_db
- laravel
- notification_db

View File

@@ -25,17 +25,22 @@ class CallController extends Controller
{
use ApiResponse;
public function store(StoreRequest $request,NotificationService $notificationService): JsonResponse
/**
* @throws OperatorNotConnectedException
* @throws OperatorOfflineException
* @throws NotificationServerNotRespondingException
*/
public function store(StoreRequest $request, NotificationService $notificationService): JsonResponse
{
try
{
$call = DB::transaction(function () use ($request)
{
$operator = User::query()->where('telephone_id', $request->telephone_id)->first();
$operator = User::query()->where('telephone_id', $request->extension)->first();
$call = Call::query()->create([
'telephone_id' => $request->telephone_id,
'caller_phone_number' => $request->caller_phone_number,
'telephone_id' => $request->extension,
'caller_phone_number' => $request->caller_id,
'operator_id' => $operator->id,
'operator_username' => $operator->username,
'operator_full_name' => $operator->full_name

View File

@@ -23,8 +23,8 @@ class StoreRequest extends FormRequest
public function rules(): array
{
return [
'telephone_id' => 'required|string|exists:users,telephone_id',
'caller_phone_number' => 'required|numeric|regex:/^09\d{9}$/',
'extension' => 'required|string|exists:users,telephone_id',
'caller_id' => 'required|numeric|regex:/^09\d{9}$/',
];
}
}

View File

@@ -13,7 +13,7 @@ return Application::configure(basePath: dirname(__DIR__))
)
->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'/auth/login' // <-- exclude this route
'*'
]);
$middleware->statefulApi();
})

View File

@@ -15,10 +15,8 @@ return new class extends Migration
$table->id();
$table->unsignedSmallInteger('category_id');
$table->string('category_name');
$table->unsignedSmallInteger('subcategory_id')->nullable();
$table->string('subcategory_name')->nullable();
$table->timestamps();
});
}

View File

@@ -13,16 +13,11 @@ return new class extends Migration
{
Schema::create('call_histories', function (Blueprint $table) {
$table->id();
$table->foreignId('call_id')
->constrained('calls');
$table->foreignId('call_id')->constrained('calls');
$table->string('telephone_id');
$table->string('caller_phone_number');
$table->foreignId('event_id')
->constrained();
$table->foreignId('event_id')->constrained('events');
$table->string('event_name');
$table->timestamps();
});
}