This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| implementation "android.arch.persistence.room:runtime:1.1.1" | |
| kapt "android.arch.persistence.room:compiler:1.1.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Entity(tableName = "film") | |
| data class Film( | |
| @PrimaryKey(autoGenerate = true) | |
| var id: String, | |
| @ColumnInfo(name = "isim") | |
| var isim: String, | |
| @ColumnInfo(name = "ozet") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Dao | |
| interface FilmDao { | |
| @Query("SELECT * FROM film") | |
| fun butunFilmler(): List<Film> | |
| @Insert(onConflict = OnConflictStrategy.IGNORE) | |
| fun filmEkle(film: Film) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Database(entities = arrayOf(Film::class), version = 1) | |
| abstract class FilmDatabase : RoomDatabase() { | |
| abstract fun filmDao(): FilmDao | |
| companion object { | |
| private var INSTANCE: FilmDatabase? = null | |
| fun getFilmDatabase(context: Context): FilmDatabase { | |
| if (INSTANCE == null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val db = FilmDatabase.getFilmDatabase(applicationContext) | |
| val filmListesi = db.filmDao().butunFimler() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask_sqlalchemy import SQLAlchemy | |
| db = SQLAlchemy() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from database.db import db | |
| class UserModel(db.Model): | |
| __tablename__ = "users" | |
| id = db.Column(db.Integer, primary_key=True) | |
| username = db.Column(db.String(80)) | |
| password = db.Column(db.String()) | |
| def __init__(self, username, password): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask_restful import Resource, reqparse | |
| from flask_jwt_extended import create_access_token, create_refresh_token, jwt_refresh_token_required, get_jwt_identity, fresh_jwt_required | |
| from models.user import UserModel | |
| import hashlib | |
| _user_parser = reqparse.RequestParser() | |
| _user_parser.add_argument( | |
| "username", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, jsonify | |
| from flask_restful import Api | |
| from flask_jwt_extended import JWTManager | |
| from resources.user import User, UserRegister, UserLogin | |
| import os | |
| app = Flask(__name__) | |
| app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DATABASE_URL", "sqlite:///data.db") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyApp extends StatefulWidget { | |
| @override | |
| State<StatefulWidget> createState() => MyAppState(); | |
| } | |
| class MyAppState extends State<MyApp> with WidgetsBindingObserver{ | |
| AppLifecycleState appLifecycleState; | |
| @override |
OlderNewer