Categories
Database Development

Converting properties to columns

I have a list of types: SELECT * FROM type; id name ———– ————————————————– 1 person 2 other god 3 location 4 role 5 gender And a list of objects each of which has a type: SELECT * FROM object; id name type_id ———– ————————————————– ———– 1 Adam 1 2 Eve 1 3 Cain 1 […]

Categories
CMS Development Drupal

Is it possible to update/remove/install 1 package with composer without updating everything?

I have seen a few posts answering this and saying that “composer require package” or “composer update package” will do this; but absolutely everything i do with composer attempts to update everything listed in require section of composer.json. I thought perhaps just removing the require lines in composer.json would avoid this mess; but composer then […]

Categories
Mastering Development

Missing and inaccurate payload in Rails with ActiveModel and Forms

I have a model for Organisation like class Organisation include ActiveModel::Model attr_accessor :orguid, :title, :firstname, :lastname, :role, :telephone, :extension, :email, :name, :branch, :address1, :address2, :address3, :city, :state, :country, :zip end In my controller I have the following actions: # frozen_string_literal: true require ‘cgi’ require ‘json’ class OrganisationsController < ApplicationController include Secured before_action :set_api, only: %i[dashboard […]

Categories
Development

sql db Scan method panic err: runtime error: invalid memory address or nil pointer dereference

when there is an user in database this method runs perfectly, but when there is no user in database with that id, i expected that will return errNoRows but it panic: func (s userDataService) FindByID(id int) (r *nxmedic.User, err error) { sqlstr := fmt.Sprintf(`SELECT id, clinic_id, personal_id, username, first_name, last_name, specialization, phone, active, email, password, […]

Categories
Development

Is there a way to setup a field-level authorisation on FaunaDB + GraphQL?

I’m having troubles finding a way to hide user emails from everyone, except the owner (user has access to only his email). Is there a way to hide a certain document field, for a certain roles? Here is an example I found that creates a role with dynamic access to the whole User collection: CreateRole({ […]

Categories
CMS Development Drupal

Website is using different version than the one listed in “composer.json file”

First of all, I have installed my website using composer with below command: composer create-project drupal-composer/drupal-project:8.x-dev my-site-name –stability dev –no-interaction and every time, I check the “Update Manager” module (/admin/modules/update) and found a new release available for drupal core, I run the below to update my website: composer update drupal/core webflo/drupal-core-require-dev –with-dependencies However, I noticed […]

Categories
Development

How do I create an async CRUD function that create a user, generate a token and login the user in node.js and Postgres?

NOTE: I am using node.js, express.js, Postgres and pg-promise library. WHAT I WANT I want the createUser function to create a new user with a hashed password, generate a token and login the user. I want to be able to see the token generated in Postman so that I will know if the code is […]

Categories
Development

Connecting the foreign key to an intermediary entity

There are 4 tables in my database. User (which has the role_id column as a foreign key), Role, Permission and an intermediary table named RolePermission (as the relationship between Role and Permission is M:N) I want to get all the permissions of a specific user based on their role_id. The intermediary table is defined like […]

Categories
Development

Checking the channel name

const Discord = require(‘discord.js’); const client = new Discord.Client(); client.on(‘ready’, (oldMessage, newMessage, role, args, guild) => { console.log(`Logged in as ${client.user.tag}!`); }); client.on(‘message’, message => { if (message.content === ‘.’) { if (message.guild.channel === ‘dot-wars’) { message.guild.members.forEach(member => { var role = message.guild.roles.find(role => role.name === ‘Dot Master!’); member.removeRole(role); }) } var role = message.guild.roles.find(role […]

Categories
Development

New Form Controls are not adding in Angular 7 reactive forms

I am trying to add mat input fields dynamically to an existing form using formArray,with a button click This is my component.ts file import { Component, OnInit, ViewChild, TemplateRef } from ‘@angular/core’; @Component({ selector: ‘app-categories-page’, templateUrl: ‘./categories-page.component.html’, styleUrls: [‘./categories-page.component.css’] }) export class CategoriesPageComponent implements OnInit { displayedColumns = [‘name’,’username’, ‘password’,’email’,’role’,’isactive’]; //users:UserModel[]=[{username:”hello”,password:”Hello”,name:”Logan”}]; dataSource: MatTableDataSource<UserModel>; categoryForm:FormGroup; public […]