23 Commits

Author SHA1 Message Date
Jake Dallimore
a0523b826e MDL-65313 core_favourites: component scoped deletion now requires itemid
This now requires itemid, which cannot be null. This is safer. The
context can still be passed in as an optional parameter.
2019-05-07 16:26:46 +08:00
Jun Pataleta
14b132750b Merge branch 'MDL-65313-master' of https://github.com/snake/moodle 2019-05-07 16:24:37 +08:00
Jake Dallimore
f962859b56 MDL-65313 core_favourite: add component-scoped favourite service class
Added a new type of service which can be used to interact with the
all favourites for a given component, not just those owned by a a
specific user. As such, objects of this type are scoped to a component.
2019-05-06 14:01:34 +08:00
Amaia Anabitarte
888a467a78 MDL-64993 core_message: Adding self-conversations to unit tests 2019-05-06 00:47:52 +02:00
Jake Dallimore
92bea7db2a MDL-64057 core_favourites: add get_join_sql_by_type() to service layer
This provides a way for external queries to include information about
favourited items.
2018-11-23 11:02:18 +08:00
Andrew Nicols
08cd15658a Merge branch 'MDL-63692-master' of git://github.com/sarjona/moodle 2018-11-20 07:51:40 +08:00
Sara Arjona
16913e60b3 MDL-63692 core_message: Add favourite conversations to Privacy API 2018-11-19 22:09:13 +01:00
Andrew Nicols
18b947671b Merge branch 'MDL-63969-master-4' of git://github.com/mihailges/moodle 2018-11-19 12:27:37 +08:00
Mihail Geshoski
61fafe8127 MDL-63969 core_favourites: Add support for removal of context users 2018-11-16 12:18:22 +08:00
Ryan Wyllie
9e189a914d MDL-63303 core_favourites: add get and count functions 2018-11-15 14:40:11 +08:00
Jake Dallimore
b81722e22f MDL-63058 core_favourites: add existence checks to the service layer
This allows someone using the user_favourite_service to check whether
an item is already marked as a favourite.
2018-10-20 12:19:10 +02:00
Jake Dallimore
21b50ebe19 MDL-63658 core_favourites: fix errors discovered on oracle db
- Assuming 1 would be a record that didn't exist. should be using 0.
- Missing space before AND in sql in provider.
2018-10-18 17:11:07 +08:00
Jake Dallimore
68eaa3150e MDL-63658 core_favourites: properly define interface methods and cleanup
This gets rid of specific repo functions which were unused, and makes
sure the following methods are defined on the interface, implemented
and tested:
- exists_by($criteria)
- find_by($criteria)
- delete_by($crtieria)
Also, added missing tests for find_favourite() repo method.
2018-10-18 15:39:57 +08:00
Jake Dallimore
8d9cd27b02 MDL-63658 core_favourites: let service object use get_component_names
This was using a helper, but now we have the function in core to achieve
the same thing, so use this instead.
2018-10-18 08:22:08 +08:00
Jake Dallimore
b7a3ec6f8d MDL-63658 core_favourites: consolidate interfaces and rename
Let's worry about reuse of the crud code later, when that requirement
arises, so moved that into the ifavourite_repository interface, and then
renamed it favourite_repository_interface.
2018-10-18 08:22:07 +08:00
Jake Dallimore
0551ed3569 MDL-63658 core_favourites: rename user_favourites_service and services
Now: user_favourite_service (singular) and service_factory
2018-10-18 08:22:07 +08:00
Jake Dallimore
cb90b549b6 MDL-63658 core_favourites: singularise the repository class types
Instead of favourites_repository we now have favourite_repository,
which is more in line with other implementations of this pattern.
2018-10-18 08:22:07 +08:00
Jake Dallimore
cfaf86b059 MDL-63658 core_favourites: make favourite a first class object
This patch adds several things:
- favourite entity class under local/entity
- refactoring of repository and service to use the new class instead
of stdClass.
- update repository unit tests to use the object instead of stdClass.
- update service_test so that the mock repo requires the object for
the add operation.
- remove unnecessary constructor from favourites_repository class.
2018-10-18 08:22:07 +08:00
Jake Dallimore
8ffbe9c163 MDL-63658 core_favourites: adding paging support to the service layer 2018-10-18 08:22:07 +08:00
Jake Dallimore
ac9138db1c MDL-63658 core_favourites: implement privacy API for favourites 2018-10-18 08:22:06 +08:00
Jake Dallimore
4a02aae5f5 MDL-63658 core_favourites: namespace the repositories and services 2018-10-18 08:22:06 +08:00
Jake Dallimore
771051325b MDL-63658 core_favourites: add business logic aware service layer 2018-10-18 08:22:06 +08:00
Jake Dallimore
d4e98ee580 MDL-63658 core_favourites: add a user favourites repository 2018-10-18 08:22:06 +08:00