tablelandnetwork / studio

Discover, design, deploy, and manage data driven web3 apps on Tableland.
https://studio.tableland.xyz
4 stars 1 forks source link

(cli,store,api) the CLI's `team ls` command now takes a wallet address as an optional arg #181

Closed joewagner closed 9 months ago

joewagner commented 9 months ago

Overview

The team ls command allowed optionally passing in a default team id as an argument. If provided, the teams associated with that default team id were returned. Since the concept of a default team id isn't explained anywhere in the docs and potentially confusing, this pr replaces it with an optional public key address as an arg.

Details

For context read through the discussion in the linear issue below.

This updates the accepted values for the optional argument to team ls. It also exposes a new api endpoint, teams.userTeamsFromAddress, and creates a new users store with a method called userDefaultTeam.
The store method takes a wallet address and returns the associated default team. The api endpoint accepts a user address, looks up the user in the users table, then returns the user's teams.

fixes https://linear.app/tableland/issue/ENG-555/cli-web-the-concept-of-a-default-team-id-is-confusing

railway-app[bot] commented 9 months ago

This PR was not deployed automatically as @joewagner does not have access to the Railway project.

In order to get automatic PR deploys, please add @joewagner to your team on Railway.

linear[bot] commented 9 months ago
ENG-555 CLI + Web: The concept of a default team id is confusing.

User's are reporting that the `team ls` command isn't working because they are trying to pass in a team id as the argument. The `team ls` command only excepts a "default team id" as an argument, but the meaning of "default team id" is confusing and not explained anywhere. **What is a "default team id"?** The ERD for Studio does not include any kind of user id, afaik, but instead relies on a conceptual model. Specifically, when you register a team is automatically created for you. This automatically created team is your "default team id". This info is mentioned in the placeholder text, *i think,* but it's likely not many people are fully reading that text. The solution here is likely going to involve better messaging in the CLI and maybe the WEB app The original report is below: If I run `studio team ls`, I see the following: ``` [ { "id": "3bb1d54b-bc06-4a29-8d61-39dc939e1406", "name": "collaborate", "slug": "collaborate", "personal": 0, "projects": [] }, { "id": "65048d24-96a8-49b4-8b84-28b636383c87", "name": "collabs", "slug": "collabs", "personal": 0, "projects": [ { "id": "5fae1e8c-1848-4d4e-b6a5-b9dd42fe682a", "name": "collabs_project", "slug": "collabs_project", "description": "this is a collabs project" } ] }, { "id": "ed43dac0-70fb-4c76-873b-5d4a4582c5ee", "name": "tabledan", "slug": "tabledan", "personal": 1, "projects": [ { "id": "eac4b0f2-ab4d-41ec-9789-19f0a4905615", "name": "starter", "slug": "starter", "description": "A starter project." } ] } ] ``` I’m running the following command with the second team ID: ``` studio team ls 65048d24-96a8-49b4-8b84-28b636383c87 ``` Which logs: ``` [] ```

joewagner commented 9 months ago

@asutula I did some global text searched and switched "default" to "personal" everywhere i could find.