change entity names

This commit is contained in:
2026-02-08 09:18:20 +03:30
parent 6be6a66079
commit 9a7010dcea
180 changed files with 2751 additions and 2513 deletions
+6 -6
View File
@@ -1,26 +1,26 @@
import type { EntityManager } from '@mikro-orm/core';
import { User } from '../modules/users/entities/user.entity';
import { Restaurant } from '../modules/restaurants/entities/restaurant.entity';
import { Shop } from ../../..shops/entities/shop.entity';
import { WalletTransaction } from '../modules/users/entities/wallet-transaction.entity';
import { WalletTransactionReason, WalletTransactionType } from 'src/modules/users/interface/wallet';
export class UserWalletsSeeder {
async run(em: EntityManager): Promise<void> {
const users = await em.find(User, {});
const restaurants = await em.find(Restaurant, {});
const shops = await em.find(Shop, {});
for (const user of users) {
for (const restaurant of restaurants) {
// Check if wallet already exists for this user-restaurant combination
for (const shop of shops) {
// Check if wallet already exists for this user-shop combination
const existingWallet = await em.findOne(WalletTransaction, {
user: { id: user.id },
restaurant: { id: restaurant.id },
shop: { id: shop.id },
});
if (!existingWallet) {
const wallet = em.create(WalletTransaction, {
user,
restaurant,
shop,
balance: 150000000,
amount: 150000000,
type: WalletTransactionType.CREDIT,