event.gno
2.89 Kb · 81 lines
1package event
2
3import (
4 zenaov1 "gno.land/p/zenao/zenao/v1"
5 "gno.land/p/zenao/events"
6 "gno.land/p/zenao/basedao"
7 "gno.land/p/zenao/daokit"
8 "gno.land/p/zenao/daocond"
9 "gno.land/r/demo/profile"
10 "gno.land/r/zenao/eventreg"
11 "gno.land/r/zenao/social_feed"
12)
13
14var (
15 DAO daokit.DAO
16 localDAO daokit.DAO
17
18 event *events.Event // XXX: needed for backward compatibility with frontend queries
19 feedId string // XXX: workaround for "unexpected zero object id" issue
20)
21
22func init() {
23 // XXX: workaround for "unexpected zero object id" issue
24 feedId = social_feed.NewFeed(cross, "main", false, feedAuth)
25}
26
27func init() {
28 conf := events.Config{
29 Organizers: []string{"gno.land/r/zenao/users/u376"},
30 Gatekeepers: []string{},
31 Title: "Projection du documentaire \"Perchés\"",
32 Description: "## Bonjour !\n\nPerchés est une immersion dans le quotidien de jeunes adultes, affectés par un trouble de la santé mentale. Ils ont décidé de créer [La Maison Perchée](https://www.maisonperchee.org), une association d'entraide animée par et pour des jeunes qui leur ressemblent. Un lieu unique en France où \"réapprendre à vivre, et non plus survivre\".\n\nAujourd'hui La Maison Perchée prend son envol et prend racine en Finistère !\n\nLe documentaire dure 52 minutes, à la suite desquelles le public pourra échanger avec Mathieu, Médiateur de Santé-Pair au CHU de Brest et Référent Région à La Maison Perchée\n\n## Plus d'informations\n\n- 📹 Projection du documentaire \"Perchés\"\n- 📆 Vendredi 16 janvier 2026 de 18h à 20h\n- 📍 Médiathèque René Pétillon, Rue de Dixmude, 29260 Lesneven",
33 ImageURI: "ipfs://bafybeiecl6yrixbdczgpxuz47jcjusfc6t5yb6rqe4hoa25vmmjctzxh3m",
34 StartDate: 1768582800,
35 EndDate: 1768590000,
36 Capacity: 42,
37 Discoverable: true,
38 GetProfileString: profile.GetStringField,
39 SetProfileString: profile.SetStringField,
40 ZenaoAdminAddr: "g1djrkw9tf4px658j85cc6fhsvm50uf9s0g6kfsm",
41 Location: &zenaov1.EventLocation{
42 Address: &zenaov1.AddressGeo{
43 Address: "Médiathèque René Pétillon - Rue de Dixmude, 29260 Lesneven, France",
44 Lat: 48.569332,
45 Lng: -4.3218465,
46 },
47 },
48 ParticipationPubkey: "",
49 CrossFn: crossFn,
50 SetImplemFn: setImplem,
51 FeedId: feedId,
52 PrivateVarName: "event",
53 }
54 event = events.NewEvent(&conf)
55 eventreg.Register(cross, func() *zenaov1.EventInfo { return event.Info() })
56}
57
58func Vote(_ realm, proposalID uint64, vote daocond.Vote) {
59 localDAO.Vote(proposalID, vote)
60}
61
62func Execute(_ realm, proposalID uint64) {
63 localDAO.Execute(proposalID)
64}
65
66func Render(path string) string {
67 return localDAO.Render(path)
68}
69
70func feedAuth() (string, bool) {
71 caller := event.DAOPrivate.CallerID() // XXX: this should be upgradable
72 return caller, basedao.MustGetMembersViewExtension(localDAO).IsMember(caller)
73}
74
75func crossFn(_ realm, cb func()) {
76 cb()
77}
78
79func setImplem(newLocalDAO daokit.DAO, newDAO daokit.DAO) {
80 localDAO, DAO = newLocalDAO, newDAO
81}