2.4 KiB
2.4 KiB
Module Planning: Cooperative Module
Overview
The Cooperative Module manages associations of users (members) who work together, typically in agriculture. It integrates deeply with user_infos to provide a complete picture of each member.
Data Models
Organization (existing)
Used to store the cooperative's main details.
id(Primary Key)hashkey(String, Unique)name(String)type(Enum:COOPERATIVE,ASSOCIATION,COMPANY)address(Text)is_active(Boolean)
CooperativeMember [NEW]
Links users to cooperatives.
id(Primary Key)hashkey(String, Unique)organization_id(Foreign Key toorganizations)user_id(Foreign Key tousers)role(String:MEMBER,OFFICER,ADMIN)joined_at(DateTime)is_active(Boolean)created_by(Foreign Key tousers)updated_by(Foreign Key tousers)
UserInfo [NEW]
Detailed personal information for users, expanding the core users table.
id(Primary Key)hashkey(String, Unique)user_id(Foreign Key tousers)firstname(String)middlename(String)lastname(String)fullname(String) - Generated or storedlandline(String)mobile(String)email(String)alt_email(String)alt_landline(String)alt_mobile(String)facebook_url(String)bank_details(JSON)addresses(JSON) - Array of address objectsother_details(JSON)is_active(Boolean)created_by(Foreign Key tousers)updated_by(Foreign Key tousers)
Core Workflows
- Cooperative Management: Creating and updating cooperative profiles (using
organizationstable). - Member Enrollment: Adding users to a cooperative and assigning roles.
- User Profile Completion: Linking users to their detailed
userinforecord.
API Endpoints (Proposed)
| Endpoint | Method | Description |
|---|---|---|
/api/cooperatives |
GET | List all cooperatives |
/api/cooperatives/{hashkey}/members |
GET | List members of a cooperative |
/api/cooperatives/{hashkey}/join |
POST | Request to join or add a member |
/api/user-info/{user_hashkey} |
GET | Get detailed user info |
/api/user-info/{user_hashkey} |
POST/PUT | Update detailed user info |
UI Components (Vue)
- CooperativeList.vue: Standard list of cooperatives.
- CooperativeDetail.vue: detailed view with member list.
- UserInfoEdit.vue: Comprehensive form for editing personal details.