@jmndao/shared-types v1.8.0
Shared Types
A collection of shared TypeScript interfaces and enums for use across multiple services.
Installation
Install the package via npm:
npm install shared-typesUsage
Importing Types
You can import types directly from the module:
import { IAccount } from "shared-types/interfaces/account";
import { IPlan } from "shared-types/services/payment/plan";Example
const account: IAccount = {
username: "john_doe",
email: "john@example.com",
role: "admin",
isVerified: true,
createdAt: new Date(),
updatedAt: new Date(),
};
const plan: IPlan = {
name: "Premium Plan",
description: "Access to all services",
price: 99.99,
currency: "USD",
frequency: "monthly",
services: ["pharmacy", "hospital"],
features: ["Unlimited storage", "24/7 support"],
isActive: true,
createdAt: new Date(),
updatedAt: new Date(),
};API Reference
Interfaces
IAccount
Represents a user account.
interface IAccount {
username: string;
email: string;
role: AccountRole;
isVerified: boolean;
createdAt: Date;
updatedAt: Date;
}IPlan
Represents a subscription plan.
interface IPlan {
name: string;
description: string;
price: number;
currency: string;
frequency: PlanFrequency;
services: ServiceType[];
features: string[];
isActive: boolean;
createdAt: Date;
updatedAt: Date;
}Enums
AccountRole
Defines the roles for user accounts.
enum AccountRole {
SuperAdmin = "super-admin",
Admin = "admin",
User = "user",
}ServiceType
Defines the types of services available.
enum ServiceType {
Pharmacy = "pharmacy",
Hospital = "hospital",
BloodBank = "blood-bank",
}Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/YourFeature). - Open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
---
### **Step 2: Add a `LICENSE` File**
If you haven’t already, add a `LICENSE` file to your project. For example, the MIT License:MIT License
Copyright (c) 2023 Your Name
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.