feat(stock): stok kategorileri, ürün tipleri, hareketler ve FIFO SKT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import type { Types } from "mongoose";
|
||||
import { installDefaultStockCategories } from "@/features/stock/service";
|
||||
import { HouseholdModel } from "@/models/household";
|
||||
import { ProductTypeModel } from "@/models/product-type";
|
||||
import { StockCategoryModel } from "@/models/stock-category";
|
||||
import { StockMovementModel } from "@/models/stock-movement";
|
||||
import type { Migration } from "./types";
|
||||
|
||||
export const migration: Migration = {
|
||||
name: "011-stock",
|
||||
description: "stok koleksiyonları index'leri; mevcut hanelere varsayılan stok kategorileri",
|
||||
async up() {
|
||||
await StockCategoryModel.createIndexes();
|
||||
await ProductTypeModel.createIndexes();
|
||||
await StockMovementModel.createIndexes();
|
||||
const households = await HouseholdModel.find({}).select({ createdBy: 1 }).lean();
|
||||
for (const h of households)
|
||||
await installDefaultStockCategories(h._id as Types.ObjectId, h.createdBy as Types.ObjectId);
|
||||
},
|
||||
};
|
||||
@@ -10,10 +10,23 @@ import { migration as m007 } from "./007-contacts";
|
||||
import { migration as m008 } from "./008-in-kind";
|
||||
import { migration as m009 } from "./009-assets";
|
||||
import { migration as m010 } from "./010-budgets";
|
||||
import { migration as m011 } from "./011-stock";
|
||||
import type { Migration } from "./types";
|
||||
|
||||
/** Sıralı migration listesi. Yeni migration: dosyayı ekle ve buraya sırayla ekle. */
|
||||
export const MIGRATIONS: Migration[] = [m001, m002, m003, m004, m005, m006, m007, m008, m009, m010];
|
||||
export const MIGRATIONS: Migration[] = [
|
||||
m001,
|
||||
m002,
|
||||
m003,
|
||||
m004,
|
||||
m005,
|
||||
m006,
|
||||
m007,
|
||||
m008,
|
||||
m009,
|
||||
m010,
|
||||
m011,
|
||||
];
|
||||
|
||||
const COLLECTION = "migrations";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user