@zari-upmydata/b2b-schemas
v1.0.17
Published
Shared MongoDB schemas for B2B profiles and companies
Keywords
Readme
B2B Schemas
A shared package containing MongoDB schemas for B2B profiles and companies using NestJS and Mongoose.
Publishing the Package
To publish updates to this package:
- Make your code changes in a feature branch
- Create a pull request to the main branch
- After the PR is approved and merged into main:
- Checkout the main branch and pull the latest changes
- Manually update the version in package.json following semantic versioning
- Run
npm publish --access publicto publish the updated package
Installation
npm install @zari-upmydata/b2b-schemasUsage
Company Schema
import { Company, CompanySchema } from '@zari-upmydata/b2b-schemas';
// In your NestJS module
@Module({
imports: [
MongooseModule.forFeature([
{ name: Company.name, schema: CompanySchema },
]),
],
})
export class YourModule {}
// In your service
export class YourService {
constructor(
@InjectModel(Company.name)
private readonly companyModel: Model<Company>,
) {}
// Use the model in your service methods
async findCompany(name: string): Promise<Company> {
return this.companyModel.findOne({ name }).exec();
}
}Available Schemas
Company Schema
The Company schema includes fields for:
- Basic company information (name, domain, description, etc.)
- Address information
- Contact information (email, phone, social media)
- Legal information
- Industry classification
- And more
HSCode Schema
The Harmonized System (HS) Code schema includes:
code: Unique identifier for the HS codedescription: Detailed description of the product categorysitcCodes: Array of references to related SITC codesnaicsCodes: Array of references to related NAICS codesparentCode: Parent HS code (optional)level: Hierarchical level in the HS classification
SITC Schema
The Standard International Trade Classification (SITC) schema includes:
code: Unique identifier for the SITC codedescription: Description of the product categoryhsCodes: Array of references to related HS codesnaicsCodes: Array of references to related NAICS codesparentCode: Parent SITC code (optional)level: Hierarchical level in the SITC classification
NAICS Schema
The North American Industry Classification System (NAICS) schema includes:
code: Unique identifier for the NAICS codedescription: Industry descriptionhsCodes: Array of references to related HS codessitcCodes: Array of references to related SITC codestitle: Short title of the industrylong_title: Detailed title of the industryparentCode: Parent NAICS code (optional)level: Hierarchical level in the NAICS classificationsicCodes: Array of related SIC codes
Schema Relationships
The schemas are interconnected through reference fields:
- HSCode ↔ SITC: Bidirectional relationship through
sitcCodesandhsCodes - HSCode ↔ NAICS: Bidirectional relationship through
naicsCodesandhsCodes - SITC ↔ NAICS: Bidirectional relationship through
naicsCodesandsitcCodes
Contributing
Please submit issues and pull requests for any improvements you'd like to make.
License
MIT
