Skip to content

Commit

Permalink
prescription domain added
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Oct 2, 2024
1 parent e80b5f0 commit 38f973e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
25 changes: 25 additions & 0 deletions server/src/domain/entities/IPrescription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export enum PrescriptionStatus {
PENDING = 'pending',
ISSUED = 'issued',
CANCELLED = 'cancelled',
}

export default interface IPrescription {
readonly _id?: string;
readonly appointmentId?: string;
readonly doctorId?: string;
readonly patientId?: string;
readonly createdAt?: Date;
readonly updatedAt?: Date;
readonly medications?: IMedication[];
readonly status?: PrescriptionStatus;
readonly notes?: string;
}

export interface IMedication {
readonly name: string;
readonly dosage: string; // e.g., '2 tablets'
readonly frequency: string; // e.g., 'twice a day'
readonly duration: string; // e.g., '5 days'
readonly additionalInstructions?: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import IPrescription from "../../entities/IPrescription";
import IRepository from "./IRepository";

export default interface IPrescriptionRepository extends IRepository<IPrescription> {
findByAppointmentId(appointmentId: string): Promise<IPrescription | null>;
}
7 changes: 7 additions & 0 deletions server/src/domain/interface/repositories/IRepository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default interface IRepository<T> {
findById(id: string): Promise<T | null>;
findAll(): Promise<T[]>;
create(entity: T): Promise<T>;
update(id: string, entity: T): Promise<T | null>;
delete(id: string): Promise<void>;
}

0 comments on commit 38f973e

Please sign in to comment.