Skip to content

Qube Cinema Assignment #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.qodo
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,81 @@ To submit a solution, fork this repo and send a Pull Request on Github.
For any questions or clarifications, raise an issue on this repo and we'll answer your questions as fast as we can.


# Distributor Permissions System

## Overview
This project implements a **Distributor Permissions System** that determines if a distributor has permission to distribute in a given region. It processes region mappings, distributor permissions, and queries efficiently using structured data handling.

## Folder Structure
```
project-root/
│── main.go
│── data/
│ ├── cities.csv # Region mappings (City, State, Country)
│ ├── permissions.txt # Distributor permissions
│ ├── queries.txt # Queries for permission checks
│── pkg/
│ ├── permissions/ # Handles distributor permissions
│ │ ├── permissions.go
│ ├── regions/ # Handles region mappings
│ │ ├── regions.go
│ ├── queries/ # Handles query processing
│ │ ├── queries.go
```

## Installation & Usage
### Prerequisites
- Go 1.18 or later installed

### Steps to Run
1. Clone the repository:
```sh
git clone https://github.com/your-repo/distributor-permissions.git
cd distributor-permissions
```
2. Place the required CSV and text files inside the `data/` directory.
3. Run the program:
```sh
go run main.go
```

## Data Files
### `cities.csv`
Contains location mappings in the format:
```
ID, Name, Type, City, State, Country
```
Example:
```
1, New York, City, New York, NY, USA
```

### `permissions.txt`
Defines permissions for distributors.
```
Permissions for Distributor1
INCLUDE: New York-NY-USA
EXCLUDE: NY-USA
Permissions for Distributor2 < Distributor1
```

### `queries.txt`
Contains queries in the format:
```
Can Distributor1 distribute in New York-NY-USA?
```

## Features
- **Hierarchical Permissions**: Distributors can inherit permissions from parent distributors.
- **Region Mapping**: Matches city, state, and country names efficiently.
- **Query Processing**: Checks whether a distributor can operate in a given region.

## License
This project is licensed under the MIT License.

## Author
Swaraj Chouriwar




Loading