@tjoc/types
v2.0.0
Published
Shared TypeScript types for TJOC platform
Maintainers
Readme
@tjoc/types
Shared TypeScript type definitions for The Journey of Code (TJOC) platform.
Installation
yarn add @tjoc/typesUsage
Import the types you need:
import { User, UserRole, Status } from '@tjoc/types';
// Create a user object with type checking
const user: User = {
id: '123',
email: '[email protected]',
firstName: 'John',
lastName: 'Doe',
role: UserRole.USER,
status: Status.ACTIVE,
emailVerified: true,
createdAt: new Date(),
updatedAt: new Date(),
};Available Types
Common Types
Status- Entity status enum (ACTIVE, INACTIVE, PENDING, etc.)Environment- Environment type enum (DEVELOPMENT, STAGING, PRODUCTION)PaginationParams- Parameters for paginated requestsPaginatedResponse<T>- Generic paginated responseApiResponse<T>- Generic API responseErrorResponse- Error response structureSuccessResponse<T>- Success response structureTimestampFields- Common timestamp fields
User Types
UserRole- User role enum (ADMIN, USER, INSTRUCTOR)UserSettings- User preferences and settingsUser- User entityCreateUserPayload- User creation payloadUpdateUserPayload- User update payload
Authentication Types
LoginPayload- Login request payloadRegisterPayload- Registration request payloadAuthResponse- Authentication responseRefreshTokenPayload- Token refresh payloadResetPasswordPayload- Password reset payloadVerifyEmailPayload- Email verification payload
Development
Setup
# Install dependencies
yarn install
# Build the package
yarn build
# Run tests
yarn test
# Run type checking
yarn typecheck
# Run linting
yarn lintTesting
Tests are written using Jest. Run them with:
# Run tests once
yarn test
# Run tests in watch mode
yarn test:watchBuilding
The package is built using tsup. Build commands:
# Build once
yarn build
# Build in watch mode
yarn devContributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This package is private and for use within TJOC platform only.
