Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme and SEO title and meta #37

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@ Set up the Backend:
**Create .env in backend folder in this format with already configurated database in MySQL:**

```
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=smetovi
DB_PORT=4000
NODE_ENV=development

SMTP_HOST=your-smtp-host # e.g., smtp.gmail.com
SMTP_PORT=your-smtp-port # e.g., 587 for TLS or 465 for SSL
[email protected] # Your email address
SMTP_PASS=your-app-password # Your app password for the email account
SENDER_EMAIL=your-sender-email # Email address from which the emails will be sent
[email protected] # Default recipient email address
DEFAULT_RECEIVER_NAME=your-reveiver-name # Name of the default recipient
DEV_DATABASE_URL = postgresql://neondb_owner:nekYVhH8Tzo6@ep-holy-moon-a5i4sdfw-pooler.us-east-2.aws.neon.tech/smetovi-dev?sslmode=require
JWT_SECRET=mysueprsecret
JWT_REFRESH_SECRET=myrefreshsupersecret
PORT=4000
SMTP_HOST=host
SMTP_PORT=465
SMTP_USER=smtp_user
SMTP_PASS=password
DEFAULT_SENDER_EMAIL=default_sender
DEFAULT_RECEIVER_EMAIL=default_receiver
DEFAULT_RECEIVER_NAME=Smetovi
```

Make sure to replace the placeholders with your actual values.
Expand All @@ -52,7 +50,7 @@ then
```
cd backend
npm i
npm run start
npm run dev
```

Running the Application
Expand Down
23 changes: 23 additions & 0 deletions backend/models/image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { DataTypes } = require("sequelize");
const { sequelize } = require("../config/db");

const Image = sequelize.define(
"Image",
{
location_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
image_url: {
type: DataTypes.STRING,
allowNull: false,
},
is_primary: {
type: DataTypes.BOOLEAN,
defaultValue: false,
},
},
{ timestamps: true }
);

module.exports = Image;
4 changes: 3 additions & 1 deletion backend/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ const Location = require('./location');
const Category = require('./category');
const RefreshToken = require('./refreshToken');
const Contact = require('./contact');
const Image = require('./image');

const initModels = async () => {
await User.sync();
await Category.sync();
await Location.sync();
await RefreshToken.sync();
await Contact.sync();
await Image.sync();
};

module.exports = { User, Location, Category, RefreshToken, Contact, initModels };
module.exports = { User, Location, Category, RefreshToken, Contact, Image, initModels };
2 changes: 2 additions & 0 deletions backend/models/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { DataTypes } = require("sequelize");
const { sequelize } = require("../config/db");
const Category = require("./category");
const User = require("./user");
const Image = require("./image");

const Location = sequelize.define(
"Location",
Expand All @@ -18,5 +19,6 @@ const Location = sequelize.define(

Location.belongsTo(Category);
Location.belongsTo(User);
Location.hasMany(Image);

module.exports = Location;
3 changes: 2 additions & 1 deletion backend/routes/authRoutes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const express = require('express');
const { register, login, refreshToken, users } = require('../controllers/authController');
const authMiddleware = require('../middleware/authMiddleware');

const router = express.Router();
if (process.env.NODE_ENV !== 'production') {
router.post('/register', register);
}
router.post('/login', login);
router.post('/refresh-token', refreshToken);
router.get('/users', users);
router.get('/users', authMiddleware, users);

module.exports = router;
11 changes: 10 additions & 1 deletion frontend/src/app/home/pages/contact/contact.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { Meta, Title } from '@angular/platform-browser';
import { ContactFormComponent } from 'src/app/home/components/contact/contact-form/contact-form.component';

@Component({
Expand All @@ -8,4 +9,12 @@ import { ContactFormComponent } from 'src/app/home/components/contact/contact-fo
standalone: true,
imports: [ContactFormComponent],
})
export class ContactComponent {}
export class ContactComponent {
constructor(private title: Title, private meta: Meta) {
this.title.setTitle('Kontakt');
this.meta.addTags([
{ name: 'description', content: 'Sve informacije na jednom mjestu o izletištu Smetovi kod Zenice' },
{ name: 'keywords', content: 'Smetovi, Izletište, Zenica, Snijeg, Kontakt' }
]);
}
}
2 changes: 1 addition & 1 deletion frontend/src/app/home/pages/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class HomeComponent implements OnInit {
locations: Location[] = [];

constructor(private locationService: LocationService, private title: Title, private meta: Meta) {
this.title.setTitle('Početna - Dobro došli');
this.title.setTitle('Početna - dobro došli na informativni portal o izletištu Smetovi');
this.meta.addTags([
{ name: 'description', content: 'Sve informacije na jednom mjestu o izletištu Smetovi kod Zenice' },
{ name: 'keywords', content: 'Smetovi, Izletište, Zenica, Snijeg' }
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/app/home/pages/location/location.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GoogleMapsModule, MapMarker, MapInfoWindow } from '@angular/google-maps
import { InfoWindowContent } from 'src/app/shared/models/info-window.model';
import { Marker } from 'src/app/shared/models/marker.model';
import { LocationService } from 'src/app/shared/services/location.service';

import { Title, Meta } from '@angular/platform-browser';

@Component({
selector: 'app-location',
Expand Down Expand Up @@ -57,7 +57,13 @@ export class LocationComponent implements OnInit {
name: '',
image: ''
};
constructor(private locationService: LocationService) {}
constructor(private locationService: LocationService, private title: Title, private meta: Meta) {
this.title.setTitle('Lokacije - sve lokacije na jednom mjestu');
this.meta.addTags([
{ name: 'description', content: 'Pregledajte sve lokacije koje se nalaze na Smetovima' },
{ name: 'keywords', content: 'Smetovi, Izletište, Zenica, Snijeg, Lokacije, Objekti' }
]);
}

ngOnInit() {
this.locationService.getLocations().subscribe({
Expand Down
Loading