post_rating

Change-Id: Ia1a6fb3f87b793a6307046e36951c1fb36b213c8
diff --git a/src/main/resources/mapper/PostRatingMapper.xml b/src/main/resources/mapper/PostRatingMapper.xml
new file mode 100644
index 0000000..097eeb8
--- /dev/null
+++ b/src/main/resources/mapper/PostRatingMapper.xml
@@ -0,0 +1,5 @@
+<insert id="insertOrUpdate">
+    INSERT INTO post_ratings (user_id, post_id, rating)
+    VALUES (#{userId}, #{postId}, #{rating})
+    ON DUPLICATE KEY UPDATE rating = VALUES(rating)
+</insert>
\ No newline at end of file
diff --git a/src/main/resources/mapper/TorrentMapper.xml b/src/main/resources/mapper/TorrentMapper.xml
index 9b53d29..243fd92 100644
--- a/src/main/resources/mapper/TorrentMapper.xml
+++ b/src/main/resources/mapper/TorrentMapper.xml
@@ -4,8 +4,8 @@
 
 <mapper namespace="com.example.g8backend.mapper.TorrentMapper">
     <insert id="insertTorrent" >
-        INSERT INTO torrents (user_id, torrent_name, info_hash, file_size)
-        VALUES (#{userId}, #{torrentName}, UNHEX(#{infoHash}), #{fileSize})
+        INSERT INTO torrents (user_id, torrent_name, file_path, info_hash, file_size)
+        VALUES (#{userId}, #{torrentName}, #{filePath}, UNHEX(#{infoHash}), #{fileSize})
     </insert>
 
     <select id="getTorrentByInfoHash" resultType="com.example.g8backend.entity.Torrent">
@@ -13,6 +13,7 @@
             torrent_id,
             user_id,
             torrent_name,
+            file_path,
             HEX(info_hash) AS infoHash,
             file_size
         FROM torrents
@@ -24,6 +25,7 @@
             torrent_id,
             user_id,
             torrent_name,
+            file_path,
             HEX(info_hash) AS infoHash,
             file_size
         FROM torrents
diff --git a/src/main/resources/mapper/UserStatsMapper.xml b/src/main/resources/mapper/UserStatsMapper.xml
new file mode 100644
index 0000000..3560a39
--- /dev/null
+++ b/src/main/resources/mapper/UserStatsMapper.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.example.g8backend.mapper.UserStatsMapper">
+    <update id="incrementTraffic">
+        UPDATE user_stats
+        SET total_upload = total_upload + #{deltaUploaded},
+            total_download = total_download + #{deltaDownloaded}
+        WHERE passkey = #{passkey}
+    </update>
+</mapper>
\ No newline at end of file