Changeset

8023:5a9d491cc714

mod_storage_internal: Add the dates method
author Kim Alvefur <zash@zash.se>
date Fri, 31 Mar 2017 17:49:51 +0200 (2017-03-31)
parents 8022:05e201468f27
children 8024:8eec715c13a6
files plugins/mod_storage_internal.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua	Fri Mar 31 17:48:50 2017 +0200
+++ b/plugins/mod_storage_internal.lua	Fri Mar 31 17:49:51 2017 +0200
@@ -120,6 +120,12 @@
 	end, count;
 end
 
+function archive:dates(username)
+	local items, err = datamanager.list_load(username, host, self.store);
+	if not items then return items, err; end
+	return array(items):pluck("when"):map(datetime.date):unique();
+end
+
 function archive:delete(username, query)
 	if not query or next(query) == nil then
 		return datamanager.list_store(username, host, self.store, nil);