{"size": 527, "ext": "js", "max_stars_repo_path": "server/src/schema/stock.js", "max_stars_repo_name": "charwavid/XiaoMu-PosSystem", "max_stars_repo_stars_event_min_datetime": "2020-01-11T05:44:20.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-23T19:10:48.000Z", "max_issues_repo_path": "server/src/schema/stock.js", "max_issues_repo_name": "charwavid/XiaoMu-PosSystem", "max_issues_repo_issues_event_min_datetime": "2020-06-09T09:36:19.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-06T16:05:32.000Z", "max_forks_repo_path": "server/src/schema/stock.js", "max_forks_repo_name": "Gnotes/Cashier-System", "max_forks_repo_forks_event_min_datetime": "2020-04-24T06:40:40.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T02:43:38.000Z"}
{"max_stars_count": 60, "max_issues_count": 4, "max_forks_count": 21, "avg_line_length": 35.1333333333, "max_line_length": 80, "alphanum_fraction": 0.6982922201}
import Joi from "@hapi/joi";
import { name as supplier_name } from "./suppliers.js";
import { barcode, in_price } from "./commodity.js";

export const commodity_item = Joi.object({
    barcode: barcode.required(),
    count: Joi.number().min(1).max(5000).required(),
    in_price: in_price.required()
});

export const createStockSchema = Joi.object({
    supplier_name: supplier_name.required(),
    description: Joi.string().min(1).max(50),
    commodity_list: Joi.array().min(1).max(200).items(commodity_item).required()
});