move types to hrl file
refactor, use 'joins' entity instead of 'with' entity
refactor table type
done with joins
primary key and foreign key in relations