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

Adds clubs models #86

Closed
wants to merge 19 commits into from
Closed

Adds clubs models #86

wants to merge 19 commits into from

Conversation

todesj
Copy link
Collaborator

@todesj todesj commented May 31, 2021

Blocked by #31, #34
Fixes #37

@github-actions
Copy link

github-actions bot commented May 31, 2021

Status: Blocked ❌

Issues blocking this PR:


This comment was automatically written by the Blocking Issues bot, and this PR will be monitored for further progress.

@github-actions github-actions bot added the blocked This issue is waiting for another issue to close label May 31, 2021
@Levi-Lesches Levi-Lesches changed the base branch from master to clubs May 31, 2021 05:04
Copy link
Member

@Levi-Lesches Levi-Lesches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, really. This is a lot in one go but it's all very consistent. I know I left a LOT of comments, but that's because it's really ready to go!

One more general point, you have to assume that pretty much all database and service calls will be a Future, so you have to await them. You already made each function async, so now you should just have to put the word await before each Services.instance.database.... I didn't put it in the comments since there are a lot of them, but see how it goes.

lib/src/data/clubs/club.dart Outdated Show resolved Hide resolved
lib/src/data/clubs/club.dart Outdated Show resolved Hide resolved
lib/src/data/contact_info.dart Outdated Show resolved Hide resolved
lib/src/models/data/clubs/club_admin.dart Outdated Show resolved Hide resolved
Comment on lines 11 to 12
// TODO: implement init
throw UnimplementedError();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some pseudo-code (like what you would do, maybe in comments) would be nice here instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should I put there though? because I don't think we need anything in init() for Club Admins.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe this doesn't need to be a data model (ie, it shouldn't be included in the Models collection). You can remove this function and extends Model. Then it'll just be a view model -- something the UI can use to make specific actions easier, but doesn't need to provide the underlying data.

lib/src/models/data/clubs/clubs.dart Outdated Show resolved Hide resolved
lib/src/models/data/clubs/clubs.dart Outdated Show resolved Hide resolved
lib/src/models/data/clubs/clubs.dart Outdated Show resolved Hide resolved
lib/src/models/data/clubs/clubs.dart Outdated Show resolved Hide resolved
lib/src/models/data/clubs/clubs.dart Outdated Show resolved Hide resolved
@Levi-Lesches
Copy link
Member

For the record, here are the assumptions this PR makes:

abstract class HybridClubs {  // Services.instance.database.clubs
	Future<List<Map>> getAll();
	Future<void> register(String id, String email, Map json);
	Future<void> unregister(String id, String email, Map json);
	ClubAdmin admin;
}

abstract HybridClubAdmin {  // Services.instance.database.clubs.admin
	Future<void> upload(String id, Map json);
	Future<void> delete(String id);
	Future<void> approve(String id);

	Future<void> postMessage(String id, Map json);
	Future<void> removeMember(String id, String email);
	Future<void> setAttendance(String id, Object attendance);
	Future<void> modifyMeeting(String id, DateTime old, DateTime? new);
}

On the data side:

  • Rename Club.facultyAdvisor -> Club.facultyAdvisors
  • Add AdminScope.clubs
  • Implement: Club.fromJson, Club.toJson, ContactInfo.toJson, Message.toJson

@CLAassistant
Copy link

CLAassistant commented Nov 24, 2021

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Levi-Lesches
❌ todesj
You have signed the CLA already but the status is still pending? Let us recheck it.

@todesj todesj closed this Jan 15, 2022
@todesj todesj deleted the clubs-models branch January 15, 2022 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This issue is waiting for another issue to close
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clubs -- models
3 participants