diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index a810528d6..9334f5d00 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -4,9 +4,10 @@

{{ this.type === 'singleCreation' - ? 'Einzelschöpfung für ' + item.first_name + ' ' + item.last_name + '' - : 'Massenschöpfung für ' + Object.keys(this.itemsMassCreation).length + ' Mitglieder' + ? 'Einzelschöpfung für ' + item.firstName + ' ' + item.lastName + '' + : 'Mehrfachschöpfung für ' + Object.keys(this.itemsMassCreation).length + ' Mitglieder' }} + {{ item }}

Bitte wähle ein oder Mehrere Mitglieder aus für die du Schöpfen möchtest @@ -105,7 +106,6 @@ :disabled="radioSelected === '' || value <= 0 || text.length < 10" > Update Schöpfung ({{ type }},{{ pagetype }}) - {{ creationUserData }} ' + this.type + ' >> für VIELE ' + i + ' Mitglieder') this.submitObj = [ { @@ -235,18 +235,18 @@ export default { moderator: this.$store.state.moderator, }, ] - alert('MassenSCHÖPFUNG ABSENDEN FÜR >> ' + i + ' Mitglieder') + alert('MehrfachSCHÖPFUNG ABSENDEN FÜR >> ' + i + ' Mitglieder') // $store - offene Schöpfungen hochzählen this.$store.commit('openCreationsPlus', i) - // lösche alle Mitglieder aus der MassenSchöpfungsListe nach dem alle Massenschpfungen zum bestätigen gesendet wurden. + // lösche alle Mitglieder aus der MehrfachSchöpfungsListe nach dem alle Mehrfachschpfungen zum bestätigen gesendet wurden. this.$emit('remove-all-bookmark') } if (this.type === 'singleCreation') { // hinweis das eine einzelne schöpfung ausgeführt wird an (Vorname) - alert('SUBMIT CREATION => ' + this.type + ' >> für ' + this.item.first_name + '') + alert('SUBMIT CREATION => ' + this.type + ' >> für ' + this.item.firstName + '') // erstellen eines Arrays (submitObj) mit allen Daten this.submitObj = [ { @@ -262,15 +262,12 @@ export default { // hinweis das eine ein einzelne Schöpfung abgesendet wird an (email) alert('UPDATE EINZEL SCHÖPFUNG ABSENDEN FÜR >> ') // umschreiben, update eine bestehende Schöpfung eine - this.creationUserData.datum = this.radioSelected.long this.creationUserData.creation_gdd = this.value this.creationUserData.text = this.text - - // this.$store.commit('update-creation-user-data', this.submitObj) } else { // hinweis das eine ein einzelne Schöpfung abgesendet wird an (email) - alert('EINZEL SCHÖPFUNG ABSENDEN FÜR >> ' + this.item.first_name + '') + alert('EINZEL SCHÖPFUNG ABSENDEN FÜR >> ' + this.item.firstName + '') // $store - offene Schöpfungen hochzählen this.$store.commit('openCreationsPlus', 1) } diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index 6fb0cb31f..c52743857 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -8,7 +8,7 @@ Usersuche | - Massenschöpfung + Mehrfachschöpfung - + @@ -64,10 +64,9 @@ @@ -75,7 +74,7 @@ :icon="type === 'PageCreationConfirm' ? 'x' : 'eye-slash-fill'" aria-label="Help" > - Details verbergen von {{ row.item.first_name }} {{ row.item.last_name }} + Details verbergen von {{ row.item.firstName }} {{ row.item.lastName }} @@ -149,7 +148,7 @@ export default { }, data() { return { - creationData: [], + creationData: {}, overlay: false, overlayBookmarkType: '', overlayItem: [], @@ -217,9 +216,6 @@ export default { alert(JSON.stringify(item)) this.$emit('remove-confirm-result', item, 'remove') }, - getCreationInMonths(creation) { - return creation.split(',') - }, editCreationUserTable(row, rowItem) { alert('editCreationUserTable') if (!row.detailsShowing) { diff --git a/admin/src/graphql/searchUsers.js b/admin/src/graphql/searchUsers.js new file mode 100644 index 000000000..86e333845 --- /dev/null +++ b/admin/src/graphql/searchUsers.js @@ -0,0 +1,12 @@ +import gql from 'graphql-tag' + +export const searchUsers = gql` + query ($searchText: String!) { + searchUsers(searchText: $searchText) { + firstName + lastName + email + creation + } + } +` diff --git a/admin/src/main.js b/admin/src/main.js index 529f78605..3be3ae0bf 100644 --- a/admin/src/main.js +++ b/admin/src/main.js @@ -61,6 +61,8 @@ Vue.use(IconsPlugin) Vue.use(moment) +Vue.use(VueApollo) + addNavigationGuards(router, store) new Vue({ diff --git a/admin/src/pages/Creation.vue b/admin/src/pages/Creation.vue index 0f88199f8..df5bea28c 100644 --- a/admin/src/pages/Creation.vue +++ b/admin/src/pages/Creation.vue @@ -44,6 +44,7 @@ diff --git a/backend/src/graphql/model/UserAdmin.ts b/backend/src/graphql/model/UserAdmin.ts index 170b3df36..cbf8dd21c 100644 --- a/backend/src/graphql/model/UserAdmin.ts +++ b/backend/src/graphql/model/UserAdmin.ts @@ -1,5 +1,4 @@ -import { ObjectType, Field, Int } from 'type-graphql' -import { KlickTipp } from './KlickTipp' +import { ObjectType, Field } from 'type-graphql' @ObjectType() export class UserAdmin { @@ -11,4 +10,7 @@ export class UserAdmin { @Field(() => String) lastName: string + + @Field(() => [Number]) + creation: number[] } diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index ce1496fa5..9af50faad 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -6,7 +6,7 @@ import { LoginUserRepository } from '../../typeorm/repository/LoginUser' @Resolver() export class AdminResolver { @Query(() => [UserAdmin]) - async getUsers(@Arg('searchText') searchText: string): Promise { + async searchUsers(@Arg('searchText') searchText: string): Promise { const loginUserRepository = getCustomRepository(LoginUserRepository) const loginUsers = await loginUserRepository.findBySearchCriteria(searchText) const users = loginUsers.map((loginUser) => { @@ -14,6 +14,11 @@ export class AdminResolver { user.firstName = loginUser.firstName user.lastName = loginUser.lastName user.email = loginUser.email + user.creation = [ + (Math.floor(Math.random() * 50) + 1) * 20, + (Math.floor(Math.random() * 50) + 1) * 20, + (Math.floor(Math.random() * 50) + 1) * 20, + ] return user }) return users diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 3f53d5538..6d9b386e9 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -270,6 +270,7 @@ export class UserResolver { const loginUser = await loginUserRepository.findByEmail(email).catch(() => { throw new Error('No user with this credentials') }) + if (!loginUser.emailChecked) throw new Error('user email not validated') const passwordHash = SecretKeyCryptographyCreateKey(email, password) // return short and long hash const loginUserPassword = BigInt(loginUser.password.toString()) if (loginUserPassword !== passwordHash[0].readBigUInt64LE()) { diff --git a/database/entity/ServerUser.ts b/database/entity/ServerUser.ts new file mode 100644 index 000000000..e776093ac --- /dev/null +++ b/database/entity/ServerUser.ts @@ -0,0 +1,31 @@ +import { BaseEntity, Entity, PrimaryGeneratedColumn, Column } from 'typeorm' + +@Entity('server_users') +export class ServerUser extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ length: 50 }) + username: string + + @Column({ type: 'bigint', unsigned: true }) + password: BigInt + + @Column({ length: 50, unique: true }) + email: string + + @Column({ length: 20, default: 'admin' }) + role: string + + @Column({ default: 0 }) + activated: number + + @Column({ name: 'last_login', default: null, nullable: true }) + lastLogin: Date + + @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP' }) + created: Date + + @Column({ name: 'created', default: () => 'CURRENT_TIMESTAMP' }) + modified: Date +}