Skip to content
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

Client table #148

Open
peterdudfield opened this issue Jul 31, 2024 · 7 comments
Open

Client table #148

peterdudfield opened this issue Jul 31, 2024 · 7 comments
Assignees

Comments

@peterdudfield
Copy link
Contributor

Detailed Description

it would be nice to have a client table, which is joined to the sites table

Context

  • nice to know which sites belong to which client
  • we could make a n by n join with users too, but perhaps this could be in a later issue

Possible Implementation

  • add client table with, client_name
  • join with sites table
  • make migration
@Bvr4
Copy link
Contributor

Bvr4 commented Sep 10, 2024

Hello, I'd like to work on this issue. Can it be assigned to me ?

Do you want other fields than client_name ?

I assume that we'll need to create crud operations to this table, and maybe an edit_site_client function ?

@peterdudfield
Copy link
Contributor Author

I think client name is good. Perhaps tge created mixin would be good too

Yea, create abd edit function would be great

Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 13, 2024
Add clientSQL in splmodels, with client_name
Mapped relationships between Client and Site
Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 13, 2024
@Bvr4
Copy link
Contributor

Bvr4 commented Sep 16, 2024

By browsing through the alembic history, I found that a client table used to exist, and has been dropped when the User and SiteGroup tables were created. Are you sure you want to reintroduce it ?

If so, can the client_uuid field in the site table can be nullalble ? If not, this will entail constraints on the production process so as not to block everything.

@peterdudfield
Copy link
Contributor Author

yea your are right @Bvr4, we used to have it, and then switched to user and sites.

We would like it back, and yes, making it nullable would be great, and then much easier to role out

Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 16, 2024
Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 16, 2024
)

add function, tests, and edited sites fixture in conftest in order to have client informations in tests samples
Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 17, 2024
@peterdudfield
Copy link
Contributor Author

It would be great to have a few functions

  • create_client
  • read_client from client_name, i like the option to create the client if it doesnt exist
  • edit_client
  • assign_site_to_client, this will make it easy to assign sites to certain client names

Feel free to split these up into different issues/ PRs if you want too, no pressure

Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 17, 2024
added create_client and edit_client functions, and related tests.
edited PVSiteEditMetadata pydantic model, so edit_site function can update the client_uuid.
edited create_site function, so it can set the client_uuid.
@Bvr4
Copy link
Contributor

Bvr4 commented Sep 17, 2024

OK, I was working on create_client and edit_client function today. I put them in write/user_and_site.py. But I wonder if it would be better in another file, like write/client.py ?

@peterdudfield
Copy link
Contributor Author

Thanks so much for this @Bvr4 . Yea I would go for a different file

Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 17, 2024
Moved the client functions from user_and_site.py to client.py
Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 17, 2024
Added get_client_by_name function, and related tests. This function can create a new client if it doesn't exist.
Bvr4 added a commit to Bvr4/pv-site-datamodel that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants