You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/06/27 09:30:31 UTC

[GitHub] [incubator-devlake] klesh opened a new issue, #2361: [team][team] Team feature implementation

klesh opened a new issue, #2361:
URL: https://github.com/apache/incubator-devlake/issues/2361

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar feature requirement.
   
   
   ### Description
   
   As we discussed on #1680 and https://lists.apache.org/thread/qx6r0pdq5x9jt099ljk1p91dh763ov84
   The final conclusion were:
   
   ## Table design (framework)
   
   1. Existing `users` is to be renamed to `accounts` and moved to `domainlayer/crossdomain` package, it contains registration records from different platforms(github/gitlab/jira etc)
   2. Add a new table `users` (id,name,email) in `domainlayer/crossdomain`, it contains unique identities, each identity may have multiple `accounts`
   3. Add a new table `user_accounts` in `domainlayer/crossdomain`, it contains the relationship between `users` and `accounts`
   4. Add a new table `user_teams` in `domainlayer/crossdomain`, it contains the relationship between `users` and `teams`, one `user` might belongs to multiple `teams`.
   
   
   ## Plugin design (named `org`)
   
   1. API `PUT /plugins/org/users.csv` accepts a CSV file, it should contain all the fields from the `users` table, and with an extra field `team`
   
   
   ### Use case
   
   _No response_
   
   ### Related issues
   
   #1680
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] Startrekzky commented on issue #2361: [Feature][team] Team feature solution

Posted by GitBox <gi...@apache.org>.
Startrekzky commented on issue #2361:
URL: https://github.com/apache/incubator-devlake/issues/2361#issuecomment-1168899685

   ## Pre-mapping logic for generating `account.csv`
   I suggest that we implement 'exact match' in v0.12.0, and fuzzy match according to user feedback in the following releases. What do you think? @klesh @yumengwang03 @hezyin 
   
   1. Based on all the `emails` in table.users, find the records under table.accounts that match the `email` field exactly.
      a) relate accounts.id to users.email, and write the relationship between accounts.id and users.id to table.user_accounts, i.e. (U001, a1), (U001, a2), (U002, a3), (U004, a4), (U005, a5), ( U005, a6) in the following pic.
      b) the accounts.id not associated to users.email will be the next matching range, i.e. (a7, a8, a9, a10).
   2. Based on all the `names` in table.users, find the exact match of the `full_name` field under table.accounts for the remaining table.accounts in step 1
      a) write the relationship between accounts.id and users.id to table.user_accounts, i.e. (U005, a7), (U008, a8)
      b) the accounts.id not associated to users.name will be the next matching range, i.e. (a9, a10).
   3. Based on all the names in table.users, find the exact match of the `user_name` field under the remaining table.accounts in step 2.
      a) associate accounts.id to users.name, and relate accounts.id to users.id to table.user_accounts, i.e. (U010, a10)
      b) accounts.id not associated to users.name, i.e. a9, is not associated to any existing users. in addition, (U003, U006, U007) in table.users is also not associated to any accounts.id.
   
   An example:<br/>
   ![image](https://user-images.githubusercontent.com/14050754/176224502-6db9d0f8-daa2-4338-a05f-ddd8fce8a149.png)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] Startrekzky commented on issue #2361: [Feature][team] Team feature solution

Posted by GitBox <gi...@apache.org>.
Startrekzky commented on issue #2361:
URL: https://github.com/apache/incubator-devlake/issues/2361#issuecomment-1169628618

   Thanks @klesh . The solution in the main thread looks good to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] Startrekzky commented on issue #2361: [Feature][team] Team feature solution

Posted by GitBox <gi...@apache.org>.
Startrekzky commented on issue #2361:
URL: https://github.com/apache/incubator-devlake/issues/2361#issuecomment-1169616747

   ## Final Data Schema
   Please take a look. @klesh @yumengwang03 @hezyin @liangjingyang 
   
   1. **table.accounts** 
       | field                    | type       | length     | description | key |
       | ----------------| -------- | --------- | ----------- | ------ |
       | `id`                    | varchar  | 255          | a user's `id` is composed of "< Plugin >:< Entity >:< PK0 >[:PK1]..."<br/>For example, a Github user's id is composed of "< github >:< GithubUsers >< GithubUserId)". Eg. 'github:GithubUsers:14050754' | PK       |
       | `email`               | varchar  | 255         | email of the account  |         |
       | `full_name`         | varchar  | 255       | full name  |         |
       | `user_name`     | varchar  | 255         | username/nickname or Github login of an account |         |
       | `avatar_url`       | varchar  | 255         |            |   |
       | `organization`   | varchar  | 255         | organization or company name                           |         |
       | `created_date` | datetime | 3             | account creation time                   |         |
       | `deleted`           | tinyint     |                 | 0: default. The user is active 1: the user is no longer active |         |
   
   2. **table.users**
       | field      | type | length | description | key|                                                                                                                                              
       | ------------- | ------- | --------- | ----------- | ------ |
       | `id`  | varchar | 255        | id of a person | PK  |
       | `email`  | varchar | 255       | the primary email of a person | PK  |
       | `name`  | varchar | 255       | name of a person | PK  |
   
   3. Output-3: a **table.user_accounts**
       | field                | type       | length    | description | key  |                                                                                                                                              
       | ------------- | -------- | -------- | ----------- | -----|
       | `user_id`       | varchar  | 255        | users.id    | FK    |
       | `acccount_id`       |  varchar | 255        | accounts.id      | FK    |
     
   4. **table.teams**
       | field              | type          | length      | description  | key     |                                                                                                                                              
       | ------------ | ---------  | --------- | -----------  | ------ |
       | `id`               | varchar    | 255          | id from the data sources, decided by DevLake users | PK  |
       | `name`         | varchar     | 255         | name of the team. Eg. team A, team B, etc. | PK  |
       | `alias`          | varchar    | 255          | alias or abbreviation of a team |   |
       | `parent_id` |  varchar    | 255         | teams.id, default to null           | FK |
       | `org_id`      |  varchar    | 255         | the id of org_id, empty for now. Would be used in the future |  |
       | `sorting_index` |  int     | 255         | the field to sort team | FK |    
   
   5. **table.team_users**
       | field                | type       | length    | description | key      |                                                                                                                                              
       | ------------- | -------- | -------- | -----------  | ------ |
       | `team_id`      | varchar  | 255        | Full name of the team. Eg. team A, team B, etc. | PK  |
       | `user_id`       | varchar  | 255        | users.id | FK |
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] Startrekzky commented on issue #2361: [Feature][team] Team feature solution (stage 1)

Posted by GitBox <gi...@apache.org>.
Startrekzky commented on issue #2361:
URL: https://github.com/apache/incubator-devlake/issues/2361#issuecomment-1190963009

   Done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] yumengwang03 commented on issue #2361: [team][team] Team feature solution

Posted by GitBox <gi...@apache.org>.
yumengwang03 commented on issue #2361:
URL: https://github.com/apache/incubator-devlake/issues/2361#issuecomment-1168171167

   We don't need UI for the first iteration, so design will wait until it's needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] Startrekzky closed issue #2361: [Feature][team] Team feature solution (stage 1)

Posted by GitBox <gi...@apache.org>.
Startrekzky closed issue #2361: [Feature][team] Team feature solution (stage 1)
URL: https://github.com/apache/incubator-devlake/issues/2361


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org