Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 735f742

Browse files
Added user-profile view so we can get profile info with user_id
1 parent 4af22a7 commit 735f742

File tree

4 files changed

+218
-11
lines changed

4 files changed

+218
-11
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
DO $$
2+
BEGIN
3+
CREATE OR REPLACE VIEW cd_user_profile AS SELECT
4+
cd_profiles.id AS profile_id,
5+
cd_profiles.name AS profile_name,
6+
cd_profiles.user_id,
7+
cd_profiles.alias,
8+
cd_profiles.dob,
9+
cd_profiles.country,
10+
cd_profiles.city,
11+
cd_profiles.private,
12+
cd_profiles.place,
13+
cd_profiles.gender,
14+
cd_profiles.address,
15+
cd_profiles.last_edited,
16+
cd_profiles.email AS profile_email,
17+
cd_profiles.phone AS profile_phone,
18+
cd_profiles.parents,
19+
cd_profiles.children,
20+
cd_profiles.linkedin,
21+
cd_profiles.twitter,
22+
cd_profiles.languages_spoken,
23+
cd_profiles.programming_languages,
24+
cd_profiles.notes,
25+
cd_profiles.projects,
26+
cd_profiles.badges,
27+
cd_profiles.countryname,
28+
cd_profiles.countrynumber,
29+
cd_profiles.continent,
30+
cd_profiles.alpha2,
31+
cd_profiles.alpha3,
32+
cd_profiles.admin1_code,
33+
cd_profiles.admin1_name,
34+
cd_profiles.admin2_code,
35+
cd_profiles.admin2_name,
36+
cd_profiles.admin3_code,
37+
cd_profiles.admin3_name,
38+
cd_profiles.admin4_code,
39+
cd_profiles.admin4_name,
40+
cd_profiles.state,
41+
cd_profiles.county,
42+
cd_profiles.place_geoname_id,
43+
cd_profiles.place_name,
44+
cd_profiles.user_type,
45+
cd_profiles.optional_hidden_fields,
46+
cd_profiles.avatar,
47+
cd_profiles.required_fields_complete,
48+
cd_profiles.ninja_invites,
49+
cd_profiles.parent_invites,
50+
sys_user.id,
51+
sys_user.nick,
52+
sys_user.email,
53+
sys_user.name,
54+
sys_user.username,
55+
sys_user.activated,
56+
sys_user.level,
57+
sys_user.mysql_user_id,
58+
sys_user.first_name,
59+
sys_user.last_name,
60+
sys_user.roles,
61+
sys_user.active,
62+
sys_user.phone,
63+
sys_user.mailing_list,
64+
sys_user.terms_conditions_accepted,
65+
sys_user.when,
66+
sys_user.confirmed,
67+
sys_user.confirmcode,
68+
sys_user.salt,
69+
sys_user.pass,
70+
sys_user.admin,
71+
sys_user.modified,
72+
sys_user.accounts,
73+
sys_user.locale,
74+
sys_user.banned,
75+
sys_user.ban_reason,
76+
sys_user.init_user_type,
77+
sys_user.join_requests,
78+
sys_user.last_login
79+
FROM sys_user JOIN cd_profiles ON sys_user.id=cd_profiles.user_id;
80+
END;
81+
$$

service.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ require('./migrate-psql-db.js')(function (err) {
4444
'users': config['users'],
4545
'logger': log.logger
4646
});
47+
seneca.use(require('./user-profile.js'),
48+
{ postgresql: config['postgresql-store'],
49+
logger: log.logger
50+
});
4751
seneca.use(require('./nodebb-api.js'), config.nodebb);
4852
seneca.use(require('cp-permissions-plugin'), {
4953
config: __dirname + '/config/permissions'

user-profile.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
module.exports = function (options) {
4+
var seneca = this;
5+
var plugin = 'cd-user-profile';
6+
var ENTITY_NS = 'cd_user_profile';
7+
8+
seneca.add({role: plugin, cmd: 'load'}, cmd_load);
9+
seneca.add({role: plugin, cmd: 'list'}, cmd_list);
10+
11+
function cmd_load (args, done) {
12+
var seneca = this;
13+
var id = args.id;
14+
seneca.make(ENTITY_NS).load$(id, done);
15+
}
16+
17+
function cmd_list (args, done) {
18+
var seneca = this;
19+
var query = {};
20+
if (args.ids) {
21+
query.ids = args.ids;
22+
} else if (args.query) {
23+
query = args.query;
24+
}
25+
seneca.make(ENTITY_NS).list$(query, done);
26+
}
27+
};

web/locale/en_US/messages.po

Lines changed: 106 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ msgstr "Yes"
2121
msgid "No"
2222
msgstr "No"
2323

24+
msgid "Loading ..."
25+
msgstr "Loading ..."
26+
2427
msgid "Register a Dojo"
2528
msgstr "Register a Dojo"
2629

@@ -54,6 +57,12 @@ msgstr "Name is empty"
5457
msgid "Name"
5558
msgstr "Name"
5659

60+
msgid "Surname"
61+
msgstr "Surname"
62+
63+
msgid "Surname is empty"
64+
msgstr "Surname is empty"
65+
5766
msgid "Email is empty"
5867
msgstr "Email is empty"
5968

@@ -78,6 +87,12 @@ msgstr "Select user type"
7887
msgid "Login"
7988
msgstr "Login"
8089

90+
msgid "Reset"
91+
msgstr "Reset"
92+
93+
msgid "Sign in"
94+
msgstr "Enter your email to sign in"
95+
8196
msgid "Zen Terms of Service"
8297
msgstr "Zen Terms of Service"
8398

@@ -447,6 +462,9 @@ msgstr "Languages Spoken"
447462
msgid "Projects"
448463
msgstr "Projects"
449464

465+
msgid "No project yet"
466+
msgstr "No project yet"
467+
450468
msgid "Prerequisites"
451469
msgstr "Prerequisites"
452470

@@ -468,8 +486,8 @@ msgstr "Development Community"
468486
msgid "Events"
469487
msgstr "Events"
470488

471-
msgid "There are no events currently listed for this Dojo. You may need to contact this Dojo to find out about upcoming events."
472-
msgstr "There are no events currently listed for this Dojo. You may need to contact this Dojo to find out about upcoming events."
489+
msgid "There are no events currently listed for this Dojo. Please contact the Dojo to find out about upcoming events."
490+
msgstr "There are no events currently listed for this Dojo. Please contact the Dojo to find out about upcoming events."
473491

474492
msgid "Word of Mouth"
475493
msgstr "Word of Mouth"
@@ -699,6 +717,12 @@ msgstr "The Dojos listed here are all verified by the CoderDojo team."
699717
msgid "Learn more"
700718
msgstr "Learn more..."
701719

720+
msgid "View more"
721+
msgstr "View more"
722+
723+
msgid "View less"
724+
msgstr "View less"
725+
702726
msgid "Search Results"
703727
msgstr "Search Results"
704728

@@ -819,6 +843,9 @@ msgstr "Contact for more information"
819843
msgid "Inactive"
820844
msgstr "Inactive"
821845

846+
msgid "Active Dojo"
847+
msgstr "Active Dojo"
848+
822849
msgid "Uh-oh! Unfortunately this Dojo is no longer active. If you would like to set up a new Dojo at this location, please email us at [email protected]"
823850
msgstr "Uh-oh! Unfortunately this Dojo is no longer active. If you would like to set up a new Dojo at this location, please email us at [email protected]"
824851

@@ -930,6 +957,9 @@ msgstr "Times"
930957
msgid "Tao verified"
931958
msgstr "Tao verified"
932959

960+
msgid "Tao unverified"
961+
msgstr "Tao unverified"
962+
933963
msgid "Join Mailing List"
934964
msgstr "Join Mailing List"
935965

@@ -1392,6 +1422,9 @@ msgstr "Every"
13921422
msgid "From"
13931423
msgstr "From"
13941424

1425+
msgid "Next date:"
1426+
msgstr "Next date:"
1427+
13951428
msgid "Close"
13961429
msgstr "Close"
13971430

@@ -2317,6 +2350,9 @@ msgstr "No Dojos match your search query."
23172350
msgid "Private Dojo"
23182351
msgstr "Private Dojo"
23192352

2353+
msgid "Public Dojo"
2354+
msgstr "Public Dojo"
2355+
23202356
msgid "This means this Dojo is only open to specific people (for example, students in a school). Please do not contact this Dojo."
23212357
msgstr "This means this Dojo is only open to specific people (for example, students in a school). Please do not contact this Dojo."
23222358

@@ -2503,6 +2539,9 @@ msgstr "Check in"
25032539
msgid "Book"
25042540
msgstr "Book"
25052541

2542+
msgid "Booking closed"
2543+
msgstr "Booking closed"
2544+
25062545
msgid "Session description"
25072546
msgstr "Session description"
25082547

@@ -2530,6 +2569,9 @@ msgstr "Cancel Session"
25302569
msgid "Cancelling a session will notify all of the attendees by email. Are you sure you want to continue?"
25312570
msgstr "Cancelling a session will notify all of the attendees by email. Are you sure you want to continue?"
25322571

2572+
msgid "Avatar"
2573+
msgstr "Avatar"
2574+
25332575
msgid "Your profile image is too large. Please resize to a maximum of 640/640 pixels."
25342576
msgstr "Your profile image is too large. Please resize to a maximum of 640/640 pixels."
25352577

@@ -2735,17 +2777,29 @@ msgstr "No invites found"
27352777
msgid "How do I choose?"
27362778
msgstr "How do I choose?"
27372779

2738-
msgid "Champion - A CoderDojo Champion is an individual who spearheads setting up and maintaining a Dojo. Champions do not necessarily have to have the ability to code but possess the skills required to bring together technical mentors and supporters to run a Dojo frequently!"
2739-
msgstr "Champion - A CoderDojo Champion is an individual who spearheads setting up and maintaining a Dojo. Champions do not necessarily have to have the ability to code but possess the skills required to bring together technical mentors and supporters to run a Dojo frequently!"
2780+
msgid "CoderDojo Champions are those who take the lead in organising a Dojo and ensure each session runs smoothly. Champions can be one person or it can be a few people who Co-Champion a Dojo to share the work. Champions should join their Dojo on Zen to set up events, award badges and to contribute to the CoderDojo Forums."
2781+
msgstr "CoderDojo Champions are those who take the lead in organising a Dojo and ensure each session runs smoothly. Champions can be one person or it can be a few people who Co-Champion a Dojo to share the work. Champions should join their Dojo on Zen to set up events, award badges and to contribute to the CoderDojo Forums."
2782+
2783+
msgid "Volunteers are the driving force behind Dojos around the world. Volunteers do everything from setting up the space, to mentoring during the Dojo, and to ensuring there is cool content for the Ninjas to do at each Dojo! Volunteers should join their Dojo on Zen to get updates on cool content, contribute to the CoderDojo Forums and to help administer the Dojo by awarding badges and setting up events!"
2784+
msgstr "Volunteers are the driving force behind Dojos around the world. Volunteers do everything from setting up the space, to mentoring during the Dojo, and to ensuring there is cool content for the Ninjas to do at each Dojo! Volunteers should join their Dojo on Zen to get updates on cool content, contribute to the CoderDojo Forums and to help administer the Dojo by awarding badges and setting up events!"
2785+
2786+
msgid "Attendees at CoderDojo are young people under 18 who attend and make CoderDojo cool. Often known as Ninjas, CoderDojo attendees come to the Dojo to have fun and bring their awesome ideas to life."
2787+
msgstr "Attendees at CoderDojo are young people under 18 who attend and make CoderDojo cool. Often known as Ninjas, CoderDojo attendees come to the Dojo to have fun and bring their awesome ideas to life."
27402788

2741-
msgid "Mentor/Volunteer - these volunteers power their local Dojos with their technical and organisational skills and inspire the next generation of coders, entrepreneurs and innovators!"
2742-
msgstr "Mentor/Volunteer - these volunteers power their local Dojos with their technical and organisational skills and inspire the next generation of coders, entrepreneurs and innovators!"
2789+
msgid "Parents/Guardians are super important in the CoderDojo journey as they encourage and inspire CoderDojo Ninjas on a daily basis. Parents should register and join a Dojo so the young people attached to their account can sign up to events and earn badges from their Champions and Mentors."
2790+
msgstr "Parents/Guardians are super important in the CoderDojo journey as they encourage and inspire CoderDojo Ninjas on a daily basis. Parents should register and join a Dojo so the young people attached to their account can sign up to events and earn badges from their Champions and Mentors."
27432791

2744-
msgid "Youth Over 13 - A Ninja is a young person who attends their local Dojo! Only Ninjas over 13 can have their own account, Ninjas under 13 must register under their Parent/Guardians account."
2745-
msgstr "Youth Over 13 - A Ninja is a young person who attends their local Dojo! Only Ninjas over 13 can have their own account, Ninjas under 13 must register under their Parent/Guardians account."
2792+
msgid "You will be joined to a Dojo as an adult, along with any young people added to your profile. We would like to know if you have any volunteering role in the Dojo too."
2793+
msgstr "You will be joined to a Dojo as an adult, along with any young people added to your profile. We would like to know if you have any volunteering role in the Dojo too."
27462794

2747-
msgid "Parent/Guardian - Parents/kids are super important in CoderDojo as they encourage and inspire CoderDojo Ninjas on a daily basis! Parents can sign up on the platform to register their kids (both aged under 13 and over 13) for their Local Dojos events and so their kids can earn badges for their profile!"
2748-
msgstr "Parent/Guardian - Parents/kids are super important in CoderDojo as they encourage and inspire CoderDojo Ninjas on a daily basis! Parents can sign up on the platform to register their kids (both aged under 13 and over 13) for their Local Dojos events and so their kids can earn badges for their profile!"
2795+
msgid "If you join the Dojo you will receive event updates from the Dojo and some newsletters from CoderDojo HQ! If you aren't a Dojo attendee and want to join as a volunteer or Champion please get in touch with the Dojo directly."
2796+
msgstr "If you join the Dojo you will receive event updates from the Dojo and some newsletters from CoderDojo HQ! If you aren't a Dojo attendee and want to join as a volunteer or Champion please get in touch with the Dojo directly."
2797+
2798+
msgid "Youths can be mentors too! If one of your Ninjas is regularly helping out others in your Dojo, give them recognition by giving them the Youth Volunteer title."
2799+
msgstr "Youths can be mentors too! If one of your Ninjas is regularly helping out others in your Dojo, give them recognition by giving them the Youth Volunteer title."
2800+
2801+
msgid "These young people are trailblazers who set an example and inspire other young people by organising and leading their local club. Young people should participate in the Dojo they Champion, meaning that Youth Champions improve their coding skills too!"
2802+
msgstr "These young people are trailblazers who set an example and inspire other young people by organising and leading their local club. Young people should participate in the Dojo they Champion, meaning that Youth Champions improve their coding skills too!"
27492803

27502804
msgid "Enabling this will require you or another admin with Ticketing Admin permissions to approve applications to attend this event."
27512805
msgstr "Enabling this will require you or another admin with Ticketing Admin permissions to approve applications to attend this event."
@@ -2804,6 +2858,11 @@ msgstr "Not all information entered on your profile is viewable. You can choose
28042858
msgid "Only your username and profile picture are publicly viewable. Other fields are for administration purposes only."
28052859
msgstr "Only your username and profile picture are publicly viewable. Other fields are for administration purposes only."
28062860

2861+
msgid "Click to view your public profile"
2862+
msgstr "Click to view your public profile"
2863+
2864+
msgid "Public profile"
2865+
msgstr "Public profile"
28072866

28082867
msgid "Registering an account does not guarantee you entry to a Dojo event. To gain entry to an event you must fill out your profile and book via the Dojo listing page. You will need your email confirmation to attend or direct permission from the Dojo administrators."
28092868
msgstr "Registering an account does not guarantee you entry to a Dojo event. To gain entry to an event you must fill out your profile and book via the Dojo listing page. You will need your email confirmation to attend or direct permission from the Dojo administrators."
@@ -3039,6 +3098,12 @@ msgstr "An error has occurred while saving youth profile"
30393098
msgid "Profile(s) have been saved successfully"
30403099
msgstr "Profile(s) have been saved successfully"
30413100

3101+
msgid "Your details"
3102+
msgstr "Your details"
3103+
3104+
msgid "About you"
3105+
msgstr "About you"
3106+
30423107
msgid "Got a child? Add them below"
30433108
msgstr "Got a child? Add them below"
30443109

@@ -3051,5 +3116,35 @@ msgstr "Remove child"
30513116
msgid "Are you sure you want to remove this child?"
30523117
msgstr "Are you sure you want to remove this child?"
30533118

3119+
msgid "You can view the"
3120+
msgstr "You can view the"
3121+
3122+
msgid "Zen roadmap"
3123+
msgstr "Zen roadmap"
3124+
3125+
msgid " and see what we are working on, as well as the latest features for Zen."
3126+
msgstr " and see what we are working on, as well as the latest features for Zen."
3127+
3128+
msgid "Access our e-learning module"
3129+
msgstr "Access our e-learning module"
3130+
3131+
msgid "By using this functionality, you allow us to share basic information with this provider (email, name, user type)"
3132+
msgstr "By using this functionality, you allow us to share basic information with this provider (email, name, user type)"
3133+
3134+
msgid "By clicking this button, you allow us to share basic information with this provider (email, name, user type)"
3135+
msgstr "By clicking this button, you allow us to share basic information with this provider (email, name, user type)"
3136+
3137+
msgid "Only modules for mentors and champions are available at the moment, come back later on to discover more!"
3138+
msgstr "Only modules for mentors and champions are available at the moment, come back later on to discover more!"
3139+
3140+
msgid "Do you agree?"
3141+
msgstr "Do you agree?"
3142+
30543143
msgid "A new dojo has been created"
3055-
msgstr "A new dojo has been created!"
3144+
msgstr "A new dojo has been created!"
3145+
3146+
msgid "You have been invited to a Dojo session"
3147+
msgstr "You have been invited to a Dojo session"
3148+
3149+
msgid "Change Role"
3150+
msgstr "Change Role"

0 commit comments

Comments
 (0)