Remove old api folder

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-21 11:47:15 +04:00
parent 597f8e0ae5
commit 0bf3c0096e
20 changed files with 0 additions and 3047 deletions
View File
-52
View File
@@ -1,52 +0,0 @@
{
"routes": [
{
"method": "GET",
"path": "/awtis",
"handler": "awtis.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/awtis/count",
"handler": "awtis.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/awtis/:id",
"handler": "awtis.findOne",
"config": {
"policies": []
}
},
{
"method": "POST",
"path": "/awtis",
"handler": "awtis.create",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/awtis/:id",
"handler": "awtis.update",
"config": {
"policies": []
}
},
{
"method": "DELETE",
"path": "/awtis/:id",
"handler": "awtis.delete",
"config": {
"policies": []
}
}
]
}
-41
View File
@@ -1,41 +0,0 @@
'use strict';
const {default: createStrapi} = require('strapi');
const {parseMultipartData, sanitizeEntity} = require('strapi-utils')
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/
const searchAwtis = async alias => {
const awtis = await strapi.query('awtis').findOne({alias: alias.trim()})
return awtis
}
module.exports = {
async create(ctx) {
let entity
if (ctx.is('multipart')) {
let {data} = parseMultipartData(ctx)
const awtis = await searchAwtis(data.alias)
if (awtis) {
entity = await strapi.services.awtis.update({id: awtis.id}, awtis)
} else {
data.published_at = null
entity = await createStrapi.services.awtis.create(data)
}
} else {
let {body} = ctx.request
const awtis = await searchAwtis(body.alias)
if (awtis) {
entity = await strapi.services.awtis.update({id: awtis.id}, awtis)
} else {
body.published_at = null
entity = await strapi.services.awtis.create(body)
}
}
return sanitizeEntity(entity, {model: strapi.models.awtis})
}
}
-799
View File
@@ -1,799 +0,0 @@
{
"paths": {
"/awtis": {
"get": {
"deprecated": false,
"description": "Find all the awtis's records",
"responses": {
"200": {
"description": "Retrieve awtis document(s)",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Awtis"
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Awtis"
],
"parameters": [
{
"name": "_limit",
"in": "query",
"required": false,
"description": "Maximum number of results possible",
"schema": {
"type": "integer"
},
"deprecated": false
},
{
"name": "_sort",
"in": "query",
"required": false,
"description": "Sort according to a specific field.",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_start",
"in": "query",
"required": false,
"description": "Skip a specific number of entries (especially useful for pagination)",
"schema": {
"type": "integer"
},
"deprecated": false
},
{
"name": "=",
"in": "query",
"required": false,
"description": "Get entries that matches exactly your input",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_ne",
"in": "query",
"required": false,
"description": "Get records that are not equals to something",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_lt",
"in": "query",
"required": false,
"description": "Get record that are lower than a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_lte",
"in": "query",
"required": false,
"description": "Get records that are lower than or equal to a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_gt",
"in": "query",
"required": false,
"description": "Get records that are greater than a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_gte",
"in": "query",
"required": false,
"description": "Get records that are greater than or equal a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_contains",
"in": "query",
"required": false,
"description": "Get records that contains a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_containss",
"in": "query",
"required": false,
"description": "Get records that contains (case sensitive) a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_in",
"in": "query",
"required": false,
"description": "Get records that matches any value in the array of values",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": false
},
{
"name": "_nin",
"in": "query",
"required": false,
"description": "Get records that doesn't match any value in the array of values",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": false
}
]
},
"post": {
"deprecated": false,
"description": "Create a new awtis record",
"responses": {
"200": {
"description": "Retrieve awtis document(s)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Awtis"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Awtis"
],
"requestBody": {
"description": "",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewAwtis"
}
}
}
}
}
},
"/awtis/count": {
"get": {
"deprecated": false,
"description": "Retrieve the number of awtis documents",
"responses": {
"200": {
"description": "Retrieve awtis document(s)",
"content": {
"application/json": {
"schema": {
"properties": {
"count": {
"type": "integer"
}
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Awtis"
],
"parameters": []
}
},
"/awtis/{id}": {
"get": {
"deprecated": false,
"description": "Find one awtis record",
"responses": {
"200": {
"description": "Retrieve awtis document(s)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Awtis"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Awtis"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
},
"put": {
"deprecated": false,
"description": "Update a single awtis record",
"responses": {
"200": {
"description": "Retrieve awtis document(s)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Awtis"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Awtis"
],
"requestBody": {
"description": "",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewAwtis"
}
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
},
"delete": {
"deprecated": false,
"description": "Delete a single awtis record",
"responses": {
"200": {
"description": "deletes a single awtis based on the ID supplied",
"content": {
"application/json": {
"schema": {
"type": "integer",
"format": "int64"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Awtis"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
}
}
},
"components": {
"schemas": {
"Awtis": {
"required": [
"id",
"alias"
],
"properties": {
"id": {
"type": "string"
},
"alias": {
"type": "string"
},
"prenon": {
"type": "string"
},
"non": {
"type": "string"
},
"biyografi": {
"type": "string"
},
"nesans": {
"type": "string",
"format": "date"
},
"foto": {
"type": "array",
"items": {
"required": [
"id",
"name",
"hash",
"mime",
"size",
"url",
"provider"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"alternativeText": {
"type": "string"
},
"caption": {
"type": "string"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"formats": {
"type": "object"
},
"hash": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "number"
},
"url": {
"type": "string"
},
"previewUrl": {
"type": "string"
},
"provider": {
"type": "string"
},
"provider_metadata": {
"type": "object"
},
"related": {
"type": "string"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
},
"teks": {
"type": "array",
"items": {
"required": [
"id",
"tit",
"transkripsyon"
],
"properties": {
"id": {
"type": "string"
},
"tit": {
"type": "string"
},
"transkripsyon": {
"type": "string"
},
"tradiksyon": {
"type": "component"
},
"lanne": {
"type": "integer"
},
"lyen": {
"type": "component"
},
"awtis": {
"type": "array",
"items": {
"type": "string"
}
},
"kouteyAchtey": {
"type": "component"
},
"slug": {
"type": "string"
},
"kouveti": {
"type": "string"
},
"okiMizikID": {
"type": "integer"
},
"user": {
"type": "string"
},
"eksplisit": {
"type": "boolean"
},
"komante": {
"type": "array",
"items": {
"type": "string"
}
},
"forceSlug": {
"type": "boolean"
},
"tradiksyonOtomatik": {
"type": "boolean"
},
"userAdmin": {
"type": "string"
},
"published_at": {
"type": "string"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
},
"user": {
"required": [
"id",
"username",
"email"
],
"properties": {
"id": {
"type": "string"
},
"username": {
"type": "string"
},
"email": {
"type": "string"
},
"provider": {
"type": "string"
},
"password": {
"type": "string"
},
"resetPasswordToken": {
"type": "string"
},
"confirmationToken": {
"type": "string"
},
"confirmed": {
"type": "boolean"
},
"blocked": {
"type": "boolean"
},
"role": {
"type": "string"
},
"canAutoTranslate": {
"type": "boolean"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string",
"format": "date-time"
}
}
},
"NewAwtis": {
"required": [
"alias"
],
"properties": {
"alias": {
"type": "string"
},
"prenon": {
"type": "string"
},
"non": {
"type": "string"
},
"biyografi": {
"type": "string"
},
"nesans": {
"type": "string",
"format": "date"
},
"teks": {
"type": "array",
"items": {
"type": "string"
}
},
"user": {
"type": "string"
},
"slug": {
"type": "string"
},
"published_at": {
"type": "string",
"format": "date-time"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
}
},
"tags": [
{
"name": "Awtis"
}
]
}
@@ -1,20 +0,0 @@
{
"paths": {
"/awtis": {
"get": {
"parameters": []
},
"post": {
"deprecated": true
}
},
"/awtis/{id}" : {
"put": {
"deprecated": true
},
"delete": {
"deprecated": true
}
}
}
}
-8
View File
@@ -1,8 +0,0 @@
'use strict';
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/services.html#core-services)
* to customize this service
*/
module.exports = {};
-24
View File
@@ -1,24 +0,0 @@
const nodemailer = require('nodemailer')
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT,
secure: false,
auth: {
user: process.env.SMTP_USERNAME,
pass: process.env.SMTP_PASSWORD
}
})
module.exports = {
send: (from, to, subject, text) => {
const options = {
from,
to,
subject,
text,
}
return transporter.sendMail(options)
}
}
-52
View File
@@ -1,52 +0,0 @@
{
"routes": [
{
"method": "GET",
"path": "/komante",
"handler": "komante.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/komante/count",
"handler": "komante.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/komante/:id",
"handler": "komante.findOne",
"config": {
"policies": []
}
},
{
"method": "POST",
"path": "/komante",
"handler": "komante.create",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/komante/:id",
"handler": "komante.update",
"config": {
"policies": []
}
},
{
"method": "DELETE",
"path": "/komante/:id",
"handler": "komante.delete",
"config": {
"policies": []
}
}
]
}
-70
View File
@@ -1,70 +0,0 @@
'use strict';
const {default: createStrapi} = require('strapi');
const {parseMultipartData, sanitizeEntity} = require('strapi-utils')
const findUser = async userId => {
const user = await strapi.query('user', 'users-permissions').findOne({id: userId})
return user
}
module.exports = {
async create(ctx) {
let entity
if (ctx.is('multipart')) {
let {data} = parseMultipartData(ctx)
data.sentAt = new Date()
data.published_at = null
entity = await createStrapi.services.komante.create(data)
} else {
let {body} = ctx.request
body.sentAt = new Date()
body.published_at = null
entity = await strapi.services.komante.create(body)
}
return sanitizeEntity(entity, {model: strapi.models.komante})
},
async find(ctx) {
let entities
if (ctx.query._q) {
entities = await strapi.services.komante.search(ctx.query, [])
for (const entity of entities) {
const user = await findUser(entity.user)
if (!user) {
throw strapi.errors.badRequest('Not found')
}
entity.username = user.username
}
} else {
entities = await strapi.services.komante.find(ctx.query, [])
for (const entity of entities) {
const user = await findUser(entity.user)
if (!user) {
throw strapi.errors.badRequest('Not found')
}
entity.username = user.username
}
}
return entities.map(entity => sanitizeEntity(entity, {model: strapi.models.komante}));
},
async findOne(ctx) {
const {id} = ctx.params
const entity = await strapi.services.komante.findOne({id}, [])
const user = await findUser(entity.user)
if (!user) {
throw strapi.errors.badRequest('Not found')
}
entity.username = user.username
return sanitizeEntity(entity, {model: strapi.models.komante})
},
}
@@ -1,701 +0,0 @@
{
"paths": {
"/komante": {
"get": {
"deprecated": false,
"description": "Find all the komante's records",
"responses": {
"200": {
"description": "Retrieve komante document(s)",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Komante"
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Komante"
],
"parameters": [
{
"name": "_limit",
"in": "query",
"required": false,
"description": "Maximum number of results possible",
"schema": {
"type": "integer"
},
"deprecated": false
},
{
"name": "_sort",
"in": "query",
"required": false,
"description": "Sort according to a specific field.",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_start",
"in": "query",
"required": false,
"description": "Skip a specific number of entries (especially useful for pagination)",
"schema": {
"type": "integer"
},
"deprecated": false
},
{
"name": "=",
"in": "query",
"required": false,
"description": "Get entries that matches exactly your input",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_ne",
"in": "query",
"required": false,
"description": "Get records that are not equals to something",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_lt",
"in": "query",
"required": false,
"description": "Get record that are lower than a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_lte",
"in": "query",
"required": false,
"description": "Get records that are lower than or equal to a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_gt",
"in": "query",
"required": false,
"description": "Get records that are greater than a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_gte",
"in": "query",
"required": false,
"description": "Get records that are greater than or equal a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_contains",
"in": "query",
"required": false,
"description": "Get records that contains a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_containss",
"in": "query",
"required": false,
"description": "Get records that contains (case sensitive) a value",
"schema": {
"type": "string"
},
"deprecated": false
},
{
"name": "_in",
"in": "query",
"required": false,
"description": "Get records that matches any value in the array of values",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": false
},
{
"name": "_nin",
"in": "query",
"required": false,
"description": "Get records that doesn't match any value in the array of values",
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": false
}
]
},
"post": {
"deprecated": false,
"description": "Create a new komante record",
"responses": {
"200": {
"description": "Retrieve komante document(s)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Komante"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Komante"
],
"requestBody": {
"description": "",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewKomante"
}
}
}
}
}
},
"/komante/count": {
"get": {
"deprecated": false,
"description": "Retrieve the number of komante documents",
"responses": {
"200": {
"description": "Retrieve komante document(s)",
"content": {
"application/json": {
"schema": {
"properties": {
"count": {
"type": "integer"
}
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Komante"
],
"parameters": []
}
},
"/komante/{id}": {
"get": {
"deprecated": false,
"description": "Find one komante record",
"responses": {
"200": {
"description": "Retrieve komante document(s)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Komante"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Komante"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
},
"put": {
"deprecated": false,
"description": "Update a single komante record",
"responses": {
"200": {
"description": "Retrieve komante document(s)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Komante"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Komante"
],
"requestBody": {
"description": "",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewKomante"
}
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
},
"delete": {
"deprecated": false,
"description": "Delete a single komante record",
"responses": {
"200": {
"description": "deletes a single komante based on the ID supplied",
"content": {
"application/json": {
"schema": {
"type": "integer",
"format": "int64"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Komante"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "",
"deprecated": false,
"required": true,
"schema": {
"type": "string"
}
}
]
}
}
},
"components": {
"schemas": {
"Komante": {
"required": [
"id",
"kontni",
"sentAt"
],
"properties": {
"id": {
"type": "string"
},
"kontni": {
"type": "string"
},
"user": {
"required": [
"id",
"username",
"email"
],
"properties": {
"id": {
"type": "string"
},
"username": {
"type": "string"
},
"email": {
"type": "string"
},
"provider": {
"type": "string"
},
"password": {
"type": "string"
},
"resetPasswordToken": {
"type": "string"
},
"confirmationToken": {
"type": "string"
},
"confirmed": {
"type": "boolean"
},
"blocked": {
"type": "boolean"
},
"role": {
"type": "string"
},
"canAutoTranslate": {
"type": "boolean"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
},
"teks": {
"required": [
"id",
"tit",
"transkripsyon"
],
"properties": {
"id": {
"type": "string"
},
"tit": {
"type": "string"
},
"transkripsyon": {
"type": "string"
},
"tradiksyon": {
"type": "component"
},
"lanne": {
"type": "integer"
},
"lyen": {
"type": "component"
},
"awtis": {
"type": "array",
"items": {
"type": "string"
}
},
"kouteyAchtey": {
"type": "component"
},
"slug": {
"type": "string"
},
"kouveti": {
"type": "string"
},
"okiMizikID": {
"type": "integer"
},
"user": {
"type": "string"
},
"eksplisit": {
"type": "boolean"
},
"komante": {
"type": "array",
"items": {
"type": "string"
}
},
"forceSlug": {
"type": "boolean"
},
"tradiksyonOtomatik": {
"type": "boolean"
},
"userAdmin": {
"type": "string"
},
"published_at": {
"type": "string"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
},
"sentAt": {
"type": "string",
"format": "date-time"
},
"published_at": {
"type": "string",
"format": "date-time"
}
}
},
"NewKomante": {
"required": [
"kontni",
"sentAt"
],
"properties": {
"kontni": {
"type": "string"
},
"user": {
"type": "string"
},
"teks": {
"type": "string"
},
"sentAt": {
"type": "string",
"format": "date-time"
},
"published_at": {
"type": "string",
"format": "date-time"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
}
},
"tags": [
{
"name": "Komante"
}
]
}
-8
View File
@@ -1,8 +0,0 @@
'use strict';
/**
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services)
* to customize this service
*/
module.exports = {};
-12
View File
@@ -1,12 +0,0 @@
{
"routes": [
{
"method": "GET",
"path": "/slugs",
"handler": "slugs.index",
"config": {
"policies": []
}
}
]
}
-12
View File
@@ -1,12 +0,0 @@
module.exports = {
index: async ctx => {
const result = await strapi
.query('teks').find({published_at_nin: null})
const sortedResult = result.sort((a, b) => {
const aDate = new Date(a.published_at)
const bDate = new Date(b.published_at)
return bDate.getTime() - aDate.getTime()
})
ctx.send(sortedResult.map(({slug}) => slug));
}
}
-66
View File
@@ -1,66 +0,0 @@
{
"paths": {
"/slugs": {
"get": {
"deprecated": false,
"description": "",
"responses": {
"200": {
"description": "response",
"content": {
"application/json": {
"schema": {
"properties": {
"foo": {
"type": "string"
}
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"summary": "",
"tags": [
"Slugs"
],
"parameters": []
}
}
},
"tags": [
{
"name": "Slugs"
}
]
}
-52
View File
@@ -1,52 +0,0 @@
{
"routes": [
{
"method": "GET",
"path": "/teks",
"handler": "teks.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/teks/count",
"handler": "teks.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/teks/:id",
"handler": "teks.findOne",
"config": {
"policies": []
}
},
{
"method": "POST",
"path": "/teks",
"handler": "teks.create",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/teks/:id",
"handler": "teks.update",
"config": {
"policies": []
}
},
{
"method": "DELETE",
"path": "/teks/:id",
"handler": "teks.delete",
"config": {
"policies": []
}
}
]
}
-51
View File
@@ -1,51 +0,0 @@
'use strict';
const {default: createStrapi} = require('strapi');
const {parseMultipartData, sanitizeEntity} = require('strapi-utils')
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/
module.exports = {
async create(ctx) {
let entity
if (ctx.is('multipart')) {
let {data} = parseMultipartData(ctx)
data.published_at = null
entity = await createStrapi.services.teks.create(data)
} else {
let {body} = ctx.request
body.published_at = null
entity = await strapi.services.teks.create(body)
}
return sanitizeEntity(entity, {model: strapi.models.teks})
},
async update(ctx) {
const {id} = ctx.params;
let entity
const teks = await strapi.query('teks').findOne({
id: ctx.params.id,
'user.id': ctx.state.user.id,
published_at: null
})
if (!teks) {
return ctx.unauthorized(`Vous ne pouvez pas mettre à jour cet élément.`)
}
if (ctx.is('multipart')) {
const {data} = parseMultipartData(ctx);
entity = await strapi.services.teks.update({id}, data)
} else {
entity = await strapi.services.teks.update({id}, ctx.request.body)
}
return sanitizeEntity(entity, {model: strapi.models.teks})
}
}
@@ -1,20 +0,0 @@
{
"paths": {
"/teks": {
"get": {
"parameters": []
},
"post": {
"deprecated": false
}
},
"/teks/{id}" : {
"put": {
"deprecated": false
},
"delete": {
"deprecated": true
}
}
}
}
File diff suppressed because it is too large Load Diff
-8
View File
@@ -1,8 +0,0 @@
'use strict';
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/services.html#core-services)
* to customize this service
*/
module.exports = {};
-39
View File
@@ -1,39 +0,0 @@
const qs = require('qs')
const axios = require('axios')
class Translator {
constructor() {
this.deeplApi = process.env.DEEPL_URL || 'api-free.deepl.com'
this.deeplKey = process.env.DEEPL_KEY
this.urlRequest = `https://${this.deeplApi}/v2/translate`
}
async get(origin, target, text) {
try {
const data = {
auth_key: this.deeplKey,
source_lang: origin,
target_lang: target,
text
}
const result = await axios.post(this.urlRequest, qs.stringify(data), {
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
})
return result.data
} catch (error) {
console.log('error', error)
}
}
}
const translator = new Translator()
async function translate(origin, target, text) {
const data = await translator.get(origin, target, text)
return data.translations[0].text
}
module.exports = {translate}