.
This commit is contained in:
parent
ddf68c32c1
commit
1f5bd18665
@ -1,11 +1,10 @@
|
||||
import type { UniqueID } from "@repo/rdx-ddd";
|
||||
import { Result } from "@repo/rdx-utils";
|
||||
|
||||
import {
|
||||
IssuedInvoice,
|
||||
} from "../../../domain";
|
||||
import { IssuedInvoice } from "../../../domain";
|
||||
import type { IInvoiceSeriesNumberAssigner } from "../../invoice-series";
|
||||
import type { IIssuedInvoiceRepository } from "../repositories";
|
||||
|
||||
import type { ProformaToIssuedInvoiceCreateProps } from "./proforma-to-issued-invoice-props-converter";
|
||||
|
||||
export interface IIssuedInvoiceCreatorParams {
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
import { AggregateRoot, Name, type TextValue, type UniqueID, type UtcDate } from "@repo/rdx-ddd";
|
||||
import { Maybe, Result } from "@repo/rdx-utils";
|
||||
import {
|
||||
AggregateRoot,
|
||||
type Name,
|
||||
type TextValue,
|
||||
type UniqueID,
|
||||
type UtcDate,
|
||||
} from "@repo/rdx-ddd";
|
||||
import { type Maybe, Result } from "@repo/rdx-utils";
|
||||
|
||||
import {
|
||||
DocumentSeriesInactiveError,
|
||||
DocumentSeriesOutOfValidityError,
|
||||
} from "../errors";
|
||||
import {
|
||||
type AssignedDocumentNumber,
|
||||
import { DocumentSeriesInactiveError, DocumentSeriesOutOfValidityError } from "../errors";
|
||||
import type {
|
||||
AssignedDocumentNumber,
|
||||
DocumentSeriesCode,
|
||||
DocumentSeriesNumber,
|
||||
type DocumentType,
|
||||
DocumentType,
|
||||
} from "../value-objects";
|
||||
|
||||
export type DocumentSeriesCreateProps = {
|
||||
@ -41,7 +44,9 @@ export class DocumentSeries extends AggregateRoot<DocumentSeriesInternalProps> {
|
||||
|
||||
public static create(props: DocumentSeriesCreateProps, id?: UniqueID) {
|
||||
if (props.padding < 0) {
|
||||
return Result.fail(new Error("Document series padding must be greater than or equal to zero."));
|
||||
return Result.fail(
|
||||
new Error("Document series padding must be greater than or equal to zero.")
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
@ -49,7 +54,9 @@ export class DocumentSeries extends AggregateRoot<DocumentSeriesInternalProps> {
|
||||
props.validTo.isSome() &&
|
||||
props.validFrom.unwrap().isAfter(props.validTo.unwrap())
|
||||
) {
|
||||
return Result.fail(new Error("Document series validFrom must be before or equal to validTo."));
|
||||
return Result.fail(
|
||||
new Error("Document series validFrom must be before or equal to validTo.")
|
||||
);
|
||||
}
|
||||
|
||||
return Result.ok(new DocumentSeries(props, id));
|
||||
@ -136,7 +143,9 @@ export class DocumentSeries extends AggregateRoot<DocumentSeriesInternalProps> {
|
||||
nextValidTo.isSome() &&
|
||||
nextValidFrom.unwrap().isAfter(nextValidTo.unwrap())
|
||||
) {
|
||||
return Result.fail(new Error("Document series validFrom must be before or equal to validTo."));
|
||||
return Result.fail(
|
||||
new Error("Document series validFrom must be before or equal to validTo.")
|
||||
);
|
||||
}
|
||||
|
||||
this.props.branchId = props.branchId ?? this.props.branchId;
|
||||
|
||||
705
pnpm-lock.yaml
705
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user